Skip to content
Xuwei Li edited this page Jan 29, 2022 · 7 revisions

How to

% ssh -i <key location> login@server.example.com 

~/.ssh/config

Host myshortname realname.example.com
    HostName realname.example.com
    IdentityFile ~/.ssh/realname_rsa # private key for realname
    User remoteusername

Host myother realname2.example.org
    HostName realname2.example.org
    IdentityFile ~/.ssh/realname2_rsa  # different private key for realname2
    User remoteusername

or

Host custom-host-name
    HostName <IP Address>
    Port 22
        User <Username>
        IdentityFile ~/.ssh/<Path to the private key>
        IdentitiesOnly yes
        TCPKeepAlive yes

Keepalive

~/.ssh/config on Client

Host *
    ServerAliveInterval 100

/etc/ssh/sshd_config on Server

TCPKeepAlive yes
...
ClientAliveInterval 60
ClientAliveCountMax 10000

Clone this wiki locally