Why does my remote session to the cluster get disconnected?

I am trying to connect to our cluster using the ssh command:

ssh -X username@scc1.bu.edu

But every time I go to lunch or am not using my laptop for a few minutes, my session is disconnected. I am using a Mac laptop.

Try to use -Y option when connecting to the cluster from Mac:

ssh -Y username@server.name

-Y option on Mac corresponds to trusted X11 forwarding. When you use ssh -Y username@server.name the remote machine is treated as trusted client.

As Pointed out by Katia, the -Y flag may do the trick especially if this only happens with X11 forwarding with -X (i.e. using a GUI).

if it doesn’t help, or it also happens without -X.
It could be the ‘keep alive’ settings
Take a look at:

and explanation breaking it down: