Effective SSH on Ubuntu

terminalUsing SSH to connect to a remote system is a part of the job for many people. There are many tweaks available to play around with SSH. However, you may not always be using the same system to connect from. Here’s a quick guide to give you a responsive experience over SSH even with X forwarding. All the changes are on the client-side. So whether it would work depends on how the server is configured too. However, in a secured network, you may not be allowed to change anything on the server which is why there are no SSH server config changes here.

In the rest of the article ssh config file refers to /etc/ssh/ssh_config on the client system from which you are connecting.

Forward X11

$ ssh -X user@remote.com

or, add the following in the ssh config file to do that permanently

Host remote.com
ForwardX11Trusted yes //if you trust remote.com
ForwardX11 yes //even if remote.com is untrusted

Compression and reasonable encryption

$ ssh -XC -c blowfish-cbc,arcfour user@remote.com

or, add the following to ssh config file

Host remote.com
 Compression yes
 Ciphers blowfish-cbc,arcfour

Disconnect hung connection

It happens more often than you think! You can get out of a hung SSH connection by keying in


i.e., you press Enter, then ~, then .

Re-use connections

This one is a bit risky because if the master session hangs, the newly created ones will also hang forcing you to delete the socket or manually kill it.

To try it out, add the following in the config file

Host *
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

If you can’t avoid using SSH from mobile or tablet devices, check out mosh.

One thought on “Effective SSH on Ubuntu”


Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s