I need that that application will start on my laptop screen when I launch, for example, "xterm". So if i start xterm in SSH my laptop must show me xterm on the screen, but it says, "DISPLAY is not set". What must i do with that?
1 Answers
You must turn on X forwarding while connecting via SSH. Use -X parameter to ssh command, like:
ssh -X 10.0.0.1
Of course your local computer (the one you are connecting from) needs to have X server running.
The X forwarding must be also enabled on the SSH server for this to work. So if the above command doesn't work, you need to enable X forwarding. You must do it on the remote machine, ie. you need to first connect there via ssh without -X.
Edit the file /etc/ssh/sshd_config (you must do it from root, so eg. use the command sudo -e /etc/ssh/sshd_config for example). Find the line that contains the string X11Forwarding. It may be commented out (# at the beginning of the line), like this:
#X11Forwarding no
Change the line so that it looks like the following (if there was no such line in the file previously, just add it):
X11Forwarding yes
(note no # at the beginning of line and yes instead of no). Save the file and restart the ssh server:
sudo service ssh restart
After this, ssh -X should work.
- 11,409