# Test key if neccessary
ssh -i ~/.ssh/id_rsa.pub user@hostname
# Copy key over to server
ssh-copy-id [user@]hostname
# You can also just print out the key as dry run
ssh-copy-id -n [user@]hostname
# Test key if neccessary
ssh -i ~/.ssh/id_rsa.pub user@hostname
# Copy key over to server
ssh-copy-id [user@]hostname
# You can also just print out the key as dry run
ssh-copy-id -n [user@]hostname
# ssh-copy-id takes care of adding your key in the right place
ssh-copy-id -i "user@hostname.example.com -p2222"
# If you don't use -i all of your public keys will be copied over.
# Also a alias for the host can be used if configured in your ssh config.
# You will be asked for the password and after that all should be taken care of.
Host My-Application-Name-or-project-name
HostName XX.XXX.XXX.XX
User ubuntu # user name of machine to login/ssh
IdentityFile C:\Users\JOHN\.ssh\mykeypair.pem
#create an identity fil name {mycert} as per your need
ssh-keygen -f ~/.ssh/mycert -t ed25519
#/.ssh/config
Host myserver
Hostname {hostname}
IdentityFile ~/.ssh/{identityFile}
User {username}
#from the console
ssh myserver
Comments