User Tools

Site Tools


mywiki:linux:ssh

SSH Login Without Password Using ssh-keygen & ssh-copy-id

Suppose need to use ssh to login to remote PC B from local PC A

  • Create public and private keys using ssh-key-gen at At PC A

Take note: make sure use empty passphrase for auto login without password case

  ssh-keygen
  Generating public/private rsa key pair.
  Enter file in which to save the key (/home/xxxx/.ssh/id_rsa):[Enter key]
  Enter passphrase (empty for no passphrase): [Press enter key only]
  Enter same passphrase again: [Press enter key again]
  Your identification has been saved in /home/xxxx/.ssh/id_rsa.
  Your public key has been saved in /home/xxxx/.ssh/id_rsa.pub.
  The key fingerprint is:
  94:12:45:fd:24:12:98:76:98:23:97:56:12:64:86:36 xxxx@local-host
  • Copy the public key from PC A to remote PC B using ssh-copy-id
  ssh-copy-id -i ~/.ssh/id_rsa.pub remote-PC-B
  xxxx@remote-PC-B's password: [key in the real key for the first time]
  • Login to remote PC B without password
  ssh remote-PC-B
mywiki/linux/ssh.txt · Last modified: by 127.0.0.1