Why does ssh X forwarding timeout after a while?

The default ForwardX11Timeout is 20 minutes for ssh -X, but you can set it to something large (e.g. 7d for 7 days) in .ssh/config

"Trusted" X11 forwarding via ssh -Y actually enables potentially nasty things like keystroke monitoring and screen grabs.


Using -X, X11 forwarding is enabled in "Untrusted" mode, making use of various X11 security extensions, including a time-limited Xauth cookie.

Use -Y to enable "Trusted" mode for X11, which will enable complete access to your X11 server.