Skip to content

Instantly share code, notes, and snippets.

@fernandoaleman
Created October 3, 2011 20:45
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save fernandoaleman/1260193 to your computer and use it in GitHub Desktop.
Save fernandoaleman/1260193 to your computer and use it in GitHub Desktop.
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