Created
December 28, 2022 20:16
-
-
Save mort3za/7829f923e2f7b15415d23fec2faf616f to your computer and use it in GitHub Desktop.
How to login to a Linux server with a second ssh key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# generate your new ssh key (e.g. id_rsa_second) | |
ssh-keygen | |
# add the public key to server manually (from your host panel) or by: | |
ssh-copy-id -i ~/.ssh/id_rsa_second.pub root@server_ip_address_here | |
vim ~/.ssh/config | |
# enter this code: | |
Host server_ip_address_here | |
AddKeysToAgent yes | |
UseKeychain yes | |
IdentityFile ~/.ssh/id_rsa_second | |
# now login to server | |
ssh root@server_ip_address_here | |
# no password is required |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment