X11 forwarding with OpenSSH

From LQWiki
Jump to navigation Jump to search

This is how to log into a remote computer over a network, and get a graphical user interface on the local computer while lessening the chances of other people eavesdropping in on your personal data.

Terminology reminder

Keep in mind that the X server is the computer that displays a gui to the user. This is typically the desktop under your table, while the X client is the computer where the application runs on, this can be a machine in the data center. This is quite obvious as a server is a program that has an open socket listening on the network. Say, a server sits there and waits for requests - exactly what your X windowing system does.

Connect

X forwarding is the possibility to work on computer A, but get the graphical display, mouse and keyboard on computer B. Imagine you sit in front of computer earth, but want to edit a text on computer mars. Do the following:

earth:~ # ssh -X root@mars
<answer a password dialog>
mars:~ # kwrite text

Now you can load and save your text on computer mars, but get it displayed on your desktop, earth, straight in front of you.

If you want ssh to always act like this, have the following line in your /etc/ssh/ssh_config:

ForwardX11 yes

See also