Save Keys SSH Servers, IP, Port HostName in Sierra MacOS - Config SSH Terminal & Tips

Though discussions both here and on several forums about the fact that the new MacOS Sierra, Private key sites are not kept Keychain after restart.

For server administrators, who use secure SSH connection with authentication key, this is a little awkward. Every time I want to authenticate via SSH / Terminal, I should execute the command: ssh-add -K ~ path / private_key.pemAfter which the Terminal command line to execute connectivity and authentication to managed servers. Usually, execute the command: ssh root @ ip_address.

A simpler solution would be to edit the file ~ / .ssh / config to create a sort of alias for both the authentication key, and for the user and hostname.

1. Open the Terminal application on MacOS and execute the command:

sudo nano ~ / .ssh / config

2. Add the following lines:

Host anyname
HostName IPServer
Port 22
User root
IdentityFile /Volumes/path/private_keys.pem

3. Ctrl + X then Y si Enter to save the changes in config.

For authentication via Terminal, will execute the command line: ssh anyname. The authentication will be done automatically with the user "root" on the hostname and port specified in the config using authentication key indicated in "IdentityFile".

In the file ~ / .ssh / config can add as many aliases want. The condition is that the line "Host" to have different names.

Save Keys SSH Servers, IP, Port HostName in Sierra MacOS - Config SSH Terminal & Tips

About the author


Passionate about everything that means gadgets and IT, I write with pleasure from 2006 and I like to discover with you new things about computers and operating systems macOS, Linux, Windows, iOS and Android.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment is processed.