1.2 KiB
1.2 KiB
A key file for SSH saves the annoying and error-prone typing of the hopefully secure and sufficiently long password. Additionally, you may prepare your local desktop to use a short name instead of having to type in a complete FQN hostname.
-
On your desktop (Linux or macOS), create a SSH keyfile if not already available. It should not be secured by password to enable automatic processing.
[…]# mkdir ~/.ssh […]# cd ~/.ssh […]# ssh-keygen -b 4096 -C <YOUR_ACCOUNT>@example.com" -f id_<outputkeyfile> -
Transfer the key file to your server.
[…]$ ssh-copy-id -i $outputkeyfile.pub <YOUR_ACCOUNT>@host.example.com -
Create a config file on your desktop with a convenient host name for your server.
[…]$ vi ~/.ssh/config Host <MYHOST> Hostname host.example.com User <YOUR_ACCOUNT> ProxyCommand none ForwardAgent no ForwardX11 no Port 22 KeepAlive yes IdentityFile ~/.ssh/$outputkeyfile -
Test the configuration
[…]$ ssh <MYHOST>