Skip to content

Instantly share code, notes, and snippets.

@kaatinga
Last active January 20, 2021 06:47
Show Gist options
  • Save kaatinga/2291a782626f9f0ce1c5a7daac65fd1f to your computer and use it in GitHub Desktop.
Save kaatinga/2291a782626f9f0ce1c5a7daac65fd1f to your computer and use it in GitHub Desktop.

First, generate a new RSA key pair, like this: ssh-keygen -t rsa -f test_server (the both files will appear in ~/.ssh folder).

Second, send your RSA key to the target server, ssh-copy-id -i test_server [email protected]. A note. The name of the file must be pointed out prior the address.

The last step, you have to indicate to the ssh utility which key to use if you connect to the 1.1.1.1 server. Edit the config file in the ~/.ssh folder like this:

#test server
Host 1.1.1.1
    HostName 1.1.1.1
    User user
    IdentityFile ~/.ssh/test_server
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment