Skip to content

Instantly share code, notes, and snippets.

@kyle-seongwoo-jun
Created December 6, 2019 02:22
Show Gist options
  • Save kyle-seongwoo-jun/e31a74076ca068e1beaf94a3fbc505fe to your computer and use it in GitHub Desktop.
Save kyle-seongwoo-jun/e31a74076ca068e1beaf94a3fbc505fe to your computer and use it in GitHub Desktop.
ssh-keygen to login without password
# generate ssh key
$ ssh-keygen -t rsa
# create .ssh/authorized_keys on server
# and paste client ssh key
# and set permission
$ ssh $username@$hostname mkdir -p .ssh
$ cat .ssh/id_rsa.pub | ssh $username@$hostname 'cat >> .ssh/authorized_keys'
$ ssh $username@$hostname "chmod 700 .ssh; chmod 640 .ssh/authorized_keys"
# connect without password
$ ssh $username@$hostname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment