User Tools

Site Tools


the_ssh_config

This is an old revision of the document!


By Joran Martijn (June 22nd 2021)

An SSH command can sometimes have multiple flags

$ ssh -i ~/.ssh/<id>_rsa -X -Y <user>@<hostname>

# -i for providing a Private Key
# -X and -Y for enabling working with graphical software and output

To type this out every time you want to start a new SSH session with a particular host can be quite a pain!

A smarter way would be to make use of the so-called SSH Config file. In this file, located at ~/.ssh/config you can specify per host which flags you want to invoke by default when SSHing into that host.

For example, let's say your SSH config file includes

Host perun
    User joran
    Hostname perun.biochem.dal.ca
    IdentityFile ~/.ssh/perun_rsa
    ForwardX11 yes
    ForwardX11Trusted yes

then the following command

$ ssh perun

is equivalent to

$ ssh -i ~/.ssh/perun_rsa -X -Y joran@perun.biochem.dal.ca
the_ssh_config.1624393766.txt.gz · Last modified: by 134.190.232.18