DEV Community

Discussion on: ssh - a treat for your GitHub

Collapse
 
dlintott profile image
Daniel Lintott

Using the SSH config file (~/.ssh/config) can come in handy here.

Specify the remote server you are connecting to using the Hoststatement.

Within the host statement you can specify the options that differ from the defaults for that host including but not limited to username and identity.

Host example.com
    User fred
    Identity File ~/.ssh/example-key

Then when you connect to the example.com server it will use the options you have specified. On some OSes this also provides auto-completion for the SSH command.

The SSH Config Man page has all the options you can specify linux.die.net/man/5/ssh_config