Skip to content

Instantly share code, notes, and snippets.

@Alex-Just
Last active February 12, 2017 13:24
Show Gist options
  • Select an option

  • Save Alex-Just/f14cc28db6f263e4a046b7e9d60cf02e to your computer and use it in GitHub Desktop.

Select an option

Save Alex-Just/f14cc28db6f263e4a046b7e9d60cf02e to your computer and use it in GitHub Desktop.
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub | ssh user@host "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
# or
cat ~/.ssh/id_rsa.pub | ssh-copy-id user@host
ssh-add -K ~/.ssh/id_rsa
# You might need to start ssh-agent
eval `ssh-agent -s`
# Force ssh client to use only password auth
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no user@host
# Use ssh key
ssh -i SMPL.pem -o 'IdentitiesOnly yes' user@host
# Disable password authentication in ssh
sudo nano /etc/ssh/sshd_config
PasswordAuthentication no
sudo service ssh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment