Abstract


  • Secure SHell
  • A Network Protocol used to enable developers to manage servers and network devices remotely

Public-key Cryptography Authentication


Setup Public-key Cryptography Authentication

  1. Generate Public Key and Private Key that are 4096 Bit using RSA (A good balance of security & performance)
ssh-keygen -t rsa -b 4096
  1. Copy the public key(the key ends with .pub) to the remote Host (Should be stored inside ~/.ssh/authorized_keys by default)
ssh-copy-id -i /path/to/your/public_key username@remote_hostname
  1. Disable password authentication & enable public key authentication. Modify /etc/ssh/sshd_config, uncomment and set the following attributes
PasswordAuthentication no
PubkeyAuthentication yes
  1. Restart the SSH server on the remote host
# Linux
sudo systemctl restart sshd
 
# MacOS
sudo launchctl stop com.openssh.sshd
sudo launchctl start com.openssh.sshd
  1. SSH into remote host with private key!
ssh -i /path/to/your/private_key username@remote_hostname