Friday, April 26, 2024
 Popular · Latest · Hot · Upcoming
176
rated 0 times [  176] [ 0]  / answers: 1 / hits: 396773  / 2 Years ago, tue, february 1, 2022, 3:29:05

Sometimes I need to start XMBC media player or other GUI software on one of my remote PC (small Xubuntu PC used as a media center).


Usually, I do this by starting an X11vnc server on the remote PC via SSH and then connecting with an Xvnc client to the Xfce desktop.


Is there a way to start a GUI software on a remote Linux PC via SSH?


Thanks!


More From » ssh

 Answers
1

Yes. You just need to run export DISPLAY=:0 (or whatever the remote display is numbered as) in your ssh session and programs run will run on the remote display. A quick example:



oli@bert:~$ ssh tim
oli@tim:~$ export DISPLAY=:0
oli@tim:~$ firefox


Firefox is now running on tim's display.



However when you close your ssh session, most of the time the remote application will close. If you want to disconnect from ssh but leave the application running you need to launch it in a special way using something like screen (keeps the ssh session running in the background) or nohup, or another method. For more information on this there was recently another question on it.



You can shorten this all down into one command that will connect, export the display in-line and start the application in a way that won't close it after the ssh session dies:



ssh tim "DISPLAY=:0 nohup firefox"

[#44746] Wednesday, February 2, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
antoccasiona

Total Points: 430
Total Questions: 127
Total Answers: 131

Location: Netherlands
Member since Sat, Jun 26, 2021
3 Years ago
antoccasiona questions
Sat, Oct 23, 21, 22:34, 3 Years ago
Sat, Sep 24, 22, 09:39, 2 Years ago
Sun, Jan 15, 23, 11:08, 1 Year ago
;