Alex-Just
12/23/2016 - 1:44 PM

ssh.sh

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