john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

X11 forwarding ssh putty tunnel gui apps on remote machine x windows

both the remote and local systems should have an xserver, (linux is easy = xorg? , windows is http://sourceforge.net/projects/xming/ the remote with sshd (openssh-server) and local with ssh client (i.e. putty)

REMOTE CONFIGURATION vi /etc/ssh/sshd_config

X11Forwarding yes

/etc/init.d/sshd reload //or slackware /etc/rc.d/rc.sshd restart /etc/init.d/sshd restart


WINDOWS: start xming (should see an X icon in the system tray) PUTTY: Connection -> SSH -> X11 = Enable X11 Forwarding usually for Xming, X display location is :0


ssh -X user@hostname # hostname or ip address, or use putty

then type, echo $DISPLAY (it will probably return localhost: 10.0 )

xclock # xclock& will run xclock in the background

ssh -C will compress the session...

for sound try setting up vnc server on the remote machine (but "local connections" only and pipe it to ssh?)

firefox # wait a long time and eventually a firefox browser will open


TROUBLESHOOTING

if you see this error (which means a file locked for writing) /usr/bin/X11/xauth: error in locking authority file /home/username/.Xauthority

try rm -r ~/.Xauthority touch ~/.Xauthority

Logged in as the user (but without X) you can run xauth will break any authority file locks before proceeding (man xauth)

xauth -b quit

Ensure that the user has a home directory cat /etc/passwd

find the username and ensure they have a home directory (e.g. /home/username) and that they have a default shell (e.g. /bin/bash)

Next ensure they are the owner of the home directory ls -ahl /home/ (should read rwx for username root) otherwise you'll have to chown -R username /home/username

If the above works you'll be logged in via SSH without any error messages you can then run (if installed) xclock firefox or any other graphical program... but be aware there's a big load time as it is literally running across the internet!

(for fun you can open up firefox and browse to a website that shows your ip address!)


FURTHER READING

http://www.vanemery.com/Linux/XoverSSH/X-over-SSH2.html


  • « Centos6 x64 openssh java7 tomcat7 ssl
  • Iptables complex example FIREWALL lockdown.sh »

Published

Feb 5, 2013

Category

linux

~310 words

Tags

  • apps 6
  • forwarding 3
  • gui 34
  • machine 4
  • on 26
  • putty 2
  • remote 15
  • ssh 14
  • tunnel 1
  • windows 72
  • x 1
  • x11 1