Skip to content

Instantly share code, notes, and snippets.

@wangyingang
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wangyingang/10107251 to your computer and use it in GitHub Desktop.
Save wangyingang/10107251 to your computer and use it in GitHub Desktop.

#SSH Login without password

  • Create public and private keys using ssh-keygen on local-host
    $ ssh-keygen
    

or

# Creates a new ssh key, using the provided email as a label
$ ssh-keygen -t rsa -C "your_email@example.com"
  • Copy the public key to remote-host using ssh-copy-id

    $ cat ~/.ssh/id_rsa.pub | ssh USER@REMOTE-HOST "mkdir -p ~/.ssh; cat >> ~/.ssh/authorized_keys"
    
  • Login to remote-host without entering the password

    $ ssh USER@REMOTE-HOST
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment