Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
SSH Login - No Password
echo "Enter ssh username & host you want to add your key to in the following format:"
read host
IP=$(curl -Sfs
KEY=$(cat ~/.ssh/
echo 'Adding Key to '$host': from="'$IP'"' $KEY
echo 'from="'$IP'"' $KEY | ssh $host 'cat >> ~/.ssh/authorized_keys'
IP=$(curl -Sfs && KEY=$(cat ~/.ssh/ && echo 'from="'$IP'"' $KEY | ssh user@host 'cat >> ~/.ssh/authorized_keys'

This comment has been minimized.

Copy link
Owner Author

@samsargent samsargent commented Jul 29, 2015

Sometime this doesn't work and you still need to enter a password..

Try the following:

Put the public key in .ssh/authorized_keys2 mv authorized_keys authorized_keys2
Change the permissions of .ssh to 700 chmod 700 .ssh
Change the permissions of .ssh/authorized_keys2 to 640 chmod 640 authorized_keys2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.