how to start a program in the gui of remote machine over ssh

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • malcsman
    New Member
    • Apr 2009
    • 6

    how to start a program in the gui of remote machine over ssh

    Hi there,

    I work in an IT support department and I'm a trainee - i started end of October 2008.
    Last week the office was quiet and I found an interesting ssh feature: remotely running a program on remote gui desktop. problem is i couldnt do it even if i had my key on the remote pc. i only managed to put xeyes on my desktop and turn my managers pc into a coo coo clock (every 15mins the cd tray would open and close).

    How would it be done?
    we both use ubuntu 8.04 and know each others pass and have our authorised keys.

    many thanks
    Malcs
  • Nepomuk
    Recognized Expert Specialist
    • Aug 2007
    • 3111

    #2
    So what you're saying is that it worked fine with two computers, but a different one wouldn't start whatever you asked it to start?
    And just to clarify: What you are doing is that from Computer A you log in to Computer B and start a program that will run on a GUI (or more accurately: on an X-Server) in Computer B, right?
    If I am right, are there any differences between the computers it works with and that one that it doesn't work on that you could tell us about? Anything, that might stop you from doing what you are trying to do?

    Greetings,
    Nepomuk


    Note to others who don't know: As ssh requires a user account on any PC you do this to, so it is not considered illegal and may therefore be discussed here.

    Comment

    • malcsman
      New Member
      • Apr 2009
      • 6

      #3
      erm.. A = my computer; B = manager/other/remote pc.

      ssh from A to B and run "xeyes": result = xeyes running on A;
      ssh from A to B and run "eject -T /dev/dvdrom1; eject -T /dev/dvdrom1": result = dvdrom1 opens/closes on B.

      it works with a command line program, but fails with a gui program. we both ssh each other without giving the password, almost everyday to send wall msgs to each other if jabber doesnt get the msg thru..

      hope i answered your questions.

      Comment

      • Nepomuk
        Recognized Expert Specialist
        • Aug 2007
        • 3111

        #4
        For the first scenario, you'll have to use ssh -X [user@]host, which enables X forwarding (if you don't understand the latter, don't worry). Does that answer your question?

        Greetings,
        Nepomuk

        Comment

        • malcsman
          New Member
          • Apr 2009
          • 6

          #5
          ye.
          what if i add -f. does that change the behaviour?
          and then if i CTRL-z and restart the job with bg %.... will the remote program be paused and un-paused or stopped and started?

          SMiLE

          Comment

          • Nepomuk
            Recognized Expert Specialist
            • Aug 2007
            • 3111

            #6
            Originally posted by malcsman
            what if i add -f. does that change the behaviour?
            It works as you would expect: ssh goes to the background and runs the command with a GUI.
            Originally posted by malcsman
            and then if i CTRL-z and restart the job with bg %.... will the remote program be paused and un-paused or stopped and started?
            Quite honestly, I don't know for sure. But how about you testing it and then posting your results here?

            Greetings,
            Nepomuk

            Comment

            Working...