Search This Blog

Setup SSH public key authentication

  1. Generate key pair:
    ssh-keygen -b 4096
    
  2. Upload public key to remote SSH server:
    ssh username@remote-ssh-server "mkdir .ssh; chmod 700 .ssh; touch .ssh/authorized_keys; chmod 600 .ssh/authorized_keys"
    ssh username@remote-ssh-server "cat >> /home/username/.ssh/authorized_keys" < ~/.ssh/id_rsa.pub
    

No comments:

Post a Comment