Page 2 of 2 FirstFirst 12
Results 11 to 18 of 18

Thread: send message to user's GUI through command line

  1. #11
    Join Date
    Apr 2012
    Beans
    6,188

    Re: send message to user's GUI through command line

    <remote-user> refers to the user whose X session you are trying to pop the message up on - you are trying to grab the magic cookie that will let your notify-send talk to their X session

    If <remote-user> doesn't have a .Xauthority (or it's in a non-standard location i.e. not the user's home dir) then I'm clueless - sorry

  2. #12
    Join Date
    May 2010
    Location
    uk
    Beans
    8,327
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: send message to user's GUI through command line

    Hi

    Just to reiterate steeldriver...

    Code:
    cat /home/<remote-user>/.Xauthority | ...
    Change the bolded remote user to the name of the user to send the message to.

    <remote-user> is just a place holder for a user name.

    If they have no X session then use the command

    Code:
    wall
    From
    Code:
    man wall
    Wall displays the contents of file or, by default, its standard input, on the terminals of all currently logged in users.
    I suspect they have an X session though.

    Kind regards
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

  3. #13
    Join Date
    Dec 2009
    Beans
    319
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: send message to user's GUI through command line

    I put the real user in place of <remote-user>, for privacy sake I put it back in for posting here.

  4. #14
    Join Date
    Dec 2009
    Beans
    319
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: send message to user's GUI through command line

    Quote Originally Posted by steeldriver View Post
    <remote-user> refers to the user whose X session you are trying to pop the message up on - you are trying to grab the magic cookie that will let your notify-send talk to their X session

    If <remote-user> doesn't have a .Xauthority (or it's in a non-standard location i.e. not the user's home dir) then I'm clueless - sorry
    also, when I do the "xauth list" it says it is creating /home/me/.Xauthority in my home directory, but an ls -A does not show one for me either.

  5. #15
    Join Date
    Apr 2012
    Beans
    6,188

    Re: send message to user's GUI through command line

    Hmm

    I guess it could be a matter of the remote user's permissions - both the machines I tested it on have the default Ubuntu umask, making the remote user's home dir drwxr-xr-x

    Another way that works for me (at least when the remote session is running under lightdm) is to grab the root cookie:

    Code:
    sudo sh -c 'DISPLAY=:0 XAUTHORITY=/var/run/lightdm/root/:0 /usr/bin/notify-send test "This is a test"'

  6. #16
    Join Date
    Dec 2009
    Beans
    319
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: send message to user's GUI through command line

    default umask is in place.

  7. #17
    Join Date
    Jun 2006
    Location
    Brisbane Australia
    Beans
    713

    Re: send message to user's GUI through command line

    Quote Originally Posted by Synoc View Post
    I would LIKE to be able to, from the command line, send a message to their GUI informing them they will need to restart their computer after they have concluded their business for the time being. Is this possible? so we are clear, I have my own account with sudoer permissions to administrate this account. I would be sending the message from my account (on the CLI) to their account (preferably a popup window in their GUI).
    Wouldn't it be easiest to just use MSN or Skype or Google Talk etc? Just initiate a group chat to pop up the dialog on all users PCs. I've not tried it but you can also use Empathy or Pidgin with the Bonjour protocol to discover and chat to local LAN users without a server. May be worth looking at?

  8. #18
    Join Date
    Dec 2009
    Beans
    319
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: send message to user's GUI through command line

    regrettably, IM programs are not on the agenda. it is looking like I will have to su into the user account and inform them or else schedule the PC to restart around 4 AM when I am certain it will not be use. less efficient, but it will do the job.

Page 2 of 2 FirstFirst 12

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •