Skip to content

Instantly share code, notes, and snippets.

@gokusenz
Last active February 13, 2019 23:13
Show Gist options
  • Save gokusenz/6a55f5154158562c85b1d8511182efb5 to your computer and use it in GitHub Desktop.
Save gokusenz/6a55f5154158562c85b1d8511182efb5 to your computer and use it in GitHub Desktop.

Home directory on the server should not be writable by others: chmod go-w /home/$USER

SSH folder on the server needs 700 permissions: chmod 700 /home/$USER/.ssh

Authorized_keys file needs 644 permissions: chmod 644 /home/$USER/.ssh/authorized_keys

Make sure that user owns the files/folders and not root: chown user:user authorized_keys and chown user:user /home/$USER/.ssh

Put the generated public key (from ssh-keygen) in the user's authorized_keys file on the server

Make sure that user's home directory is set to what you expect it to be and that it contains the correct .ssh folder that

you've been modifying. If not, use usermod -d /home/$USER $USER to fix the issue

Finally, restart ssh: service ssh restart

Then make sure client has the public key and private key files in the local user's .ssh folder and login: ssh [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment