Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to install SSH Keys for authentication without password
# Create ssh private and public keys on your local machine
ssh-keygen -t rsa
# Set permissions on your private key
chmod 700 ~/.ssh
chmod 600 ~/.ssh/id_rsa
# Copy the public key to the server
scp ~/.ssh/id_rsa.pub root@yourserver.com:~/.ssh/authorized_keys
# On the server, set permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
# If you have SELinux enabled and your SSH Keys will not work
# try running the following command
restorecon -v /root/.ssh/authorized_keys
# If you want to turn SELinux off, while system is running
echo 0 > /selinux/enforce
# You can also turn SELinux off by updating config file
vi /etc/selinux/config
# and change
SELINUX=enforcing
# to
SELINUX=disabled
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.