I've logged into the remote machine via ssh and used the command
firefox --display:192.168.1.2:0
Where 192.168.1.2 is the IP address of the local machine.
But it says "Error: cannot open display: 192.168.1.2:0"
2 Answers
Edit /etc/ssh/sshd_config on the remote machine. It should contain this:
X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yesRestart sshd.
Login to remote via ssh as usual but don't forget to use -X option (enable X11 forwarding). Using -C (compression) is also recommended because X through ssh will be much slower than through telnet anyway.
Once you logged in, without setting DISPLAY yourself, type
$ echo $DISPLAYit should show this strange value:
localhost:10.0It's strange but perfect. Now you can just type
firefoxand wait for its window to open. Wait really means wait because unless the remote machine is very close to you, it will take a while. Be patient.
2if running from an unix like host (ubuntu for instance), try
ssh -Xaccording to ssh man page
-X Enables X11 forwarding. This can also be specified on a per- host basis in a configuration file. X11 forwarding should be enabled with caution. Users with the ability to bypass file permissions on the remote host (for the user's X authorization database) can access the local X11 dis- play through the forwarded connection. An attacker may then be able to perform activities such as keystroke monitoring. For this reason, X11 forwarding is subjected to X11 SECURITY extension restrictions by default. Please refer to the ssh -Y option and the ForwardX11Trusted directive in ssh_config(5) for more information.if running from windows, be sure to have a X session tools like Xming.
for Xming, set display number in Xming (e.g. 1234) allow all host, instruct putty to use display number 1234, and check "forward X11 connection".