Ubuntu – the difference between `ssh -Y` (trusted X11 forwarding) and `ssh -X` (untrusted X11 forwarding)

sshx11-forwardingxorg

What is the difference between ssh -Y (trusted X11 forwarding) and ssh -X (untrusted X11 forwarding)? As far as I have understood it, it has something to do with security, but I did not grasp the difference and when to use which.

Best Answer

Both options have something to do with X11 forwarding. This means if you enable this, you can use a graphical client through your SSH session (e.g., use Firefox or something else).

If you use ssh -X remotemachine the remote machine is treated as an untrusted client. So your local client sends a command to the remote machine and receives the graphical output. If your command violates some security settings you'll receive an error instead.

But if you use ssh -Y remotemachine the remote machine is treated as a trusted client. This last option can open security problems. Because other graphical (X11) clients could sniff data from the remote machine (make screenshots, do keylogging and other nasty stuff) and it is even possible to alter those data.

If you want to know more about those things, I suggest reading the Xsecurity manpage or the X Security extension spec. Furthermore, you can check the options ForwardX11 and ForwardX11Trusted in your /etc/ssh/ssh_config.