Friday, November 8, 2013

Ubuntu - How to launch a GUI program in a remote Ubuntu box via SSH

To launch a GUI program in a xUbuntu machine from a remote xUbuntu box, following these steps:

1. Assuming someone had logged-in to the remote machine (let call it R) with user 'remoteuser' in graphical mode (init 5)

2. From my computer, ssh to R machine with user 'remoteuser' (!important, if you login to R with another user, this won't work):

trinh@local-pc$ ssh remoteuser@R.IP.Address

3. Run the following command before launch any graphical program:

remoteuser@remote-pc$ export DISPLAY=:0

4. Finally, launch whatever GUI program you want, for example: Firefox:

remoteuser@remote-pc$ firefox &