How to Perform SSH Login Without Password Using ssh-keygen & ssh-copy-id ?
#Generate SSH Private/Public key pair.
#Add public key to the server
ssh-copy-id -i ~/.ssh/id_rsa.pub email@example.com
#If you have a message like : sign_and_send_pubkey: signing failed: agent refused operation, Add the key using:
Method 2: (Not tested)
#/!\ For the first time only
ssh-keygen -t rsa
#For all servers
ssh firstname.lastname@example.org mkdir -p .ssh
cat ~/.ssh/id_rsa.pub | ssh email@example.com 'cat >> .ssh/authorized_keys'
ssh firstname.lastname@example.org "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
# Optionally, you can add custom commands. Example : ll alias.
echo "alias ll='ls -alFh --color=auto'" >> ~/.bashrc;
Remove a key (On server)
- Login to the server
- Edit file
.ssh/authorized_keys, Delete the unwanted key