Advertisement
thioshp

SSH Login Without Password

Aug 4th, 2016
409
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. Public key authentication allows you to login to a remote host via the SSH protocol without a password and is more secure than password-based authentication. Try creating a passwordless connection from linuxconfig.local to linuxconfig.org using public-key authentication.
  2.  
  3. 1. Create key
  4. Press ENTER at every prompt.
  5.  
  6. linuxconfig.local$ ssh-keygen
  7. Generating public/private rsa key pair.
  8. Enter file in which to save the key (/home/user/.ssh/id_rsa):
  9. Enter passphrase (empty for no passphrase):
  10. Enter same passphrase again:
  11. Your identification has been saved in /home/user/.ssh/id_rsa.
  12. Your public key has been saved in /home/user/.ssh/id_rsa.pub.
  13. The key fingerprint is:
  14. b2:ad:a0:80:85:ad:6c:16:bd:1c:e7:63:4f:a0:00:15 user@host
  15. The key's randomart image is:
  16. +--[ RSA 2048]----+
  17. | E. |
  18. | . |
  19. |. |
  20. |.o. |
  21. |.ooo o. S |
  22. |oo+ * .+ |
  23. |++ +.+... |
  24. |o. ...+. |
  25. | . .. |
  26. +-----------------+
  27. linuxconfig.local$
  28. For added security '''the key itself''' would be protected using a strong ''passphrase''. If a passphrase is used to protect the key, ssh-agent can be used to cache the passphrase.
  29.  
  30. 2. Copy key to remote host
  31. linuxconfig.local$ ssh-copy-id root@linuxconfig.org
  32. root@linuxconfig.org's password:
  33. Now try logging into the machine, with "ssh 'root@linuxconfig.org'", and check in:
  34.  
  35. .ssh/authorized_keys
  36.  
  37. to make sure we haven't added extra keys that you weren't expecting.
  38. linuxconfig.local$
  39. 3. Login to remote host
  40. Note that no password is required.
  41.  
  42. linuxconfig.local$ ssh root@linuxconfig.org
  43. Last login: Tue Apr 3 12:47:53 2007 from 192.168.0.39
  44. linuxconfig.org#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement