Abstract
- Secure SHell
- A Network Protocol used to enable developers to manage servers and network devices remotely
Public-key Cryptography Authentication
- We can use username and password, but SSH supports Asymmetric Cryptography which is more secure
Setup Public-key Cryptography Authentication
- Generate Public Key and Private Key that are 4096 Bit using RSA (A good balance of security & performance)
ssh-keygen -t rsa -b 4096
- 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
- Disable password authentication & enable public key authentication. Modify
/etc/ssh/sshd_config
, uncomment and set the following attributesPasswordAuthentication no PubkeyAuthentication yes
- 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
- SSH into remote host with private key!
ssh -i /path/to/your/private_key username@remote_hostname