User Tools

Site Tools


howto:sshkey

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howto:sshkey [2025/05/12 21:44] – created justip6howto:sshkey [2025/05/12 21:51] (current) – [Ubuntu] justip6
Line 15: Line 15:
 The *.pub file needs to be appended to the ~/.ssh/authorized_keys file to be recognized by ssh.  This should be done on any remote hosts you wish to connect to using public-key authorization.  Be sure each key starts on its own new line, since many users may need to connect to the machine and all be able to add their public keys to the authorized_keys file. The code below should do it: The *.pub file needs to be appended to the ~/.ssh/authorized_keys file to be recognized by ssh.  This should be done on any remote hosts you wish to connect to using public-key authorization.  Be sure each key starts on its own new line, since many users may need to connect to the machine and all be able to add their public keys to the authorized_keys file. The code below should do it:
 <code bash> <code bash>
 +# Your pub key's filename may differ depending on whether it was ed25519 (id_ed25519.pub), rsa (id_rsa.pub) or dsa (id_dsa.pub)
 [user@localhost ~]$ scp ~/.ssh/id_ed25519.pub user@remotehost:/home/user/.ssh/my_id.pub [user@localhost ~]$ scp ~/.ssh/id_ed25519.pub user@remotehost:/home/user/.ssh/my_id.pub
 Enter password for user@remotehost: Enter password for user@remotehost:
 [user@localhost ~]$ ssh user@remotehost [user@localhost ~]$ ssh user@remotehost
 Enter Password Enter Password
-# That's the last time you'll be entering your password! 
 [user@remotehost ~]$ cd .ssh [user@remotehost ~]$ cd .ssh
 [user@remotehost .ssh]$ cat my_id.pub >> authorized_keys [user@remotehost .ssh]$ cat my_id.pub >> authorized_keys
 [user@remotehost .ssh]$ rm my_id.pub [user@remotehost .ssh]$ rm my_id.pub
 </code> </code>
howto/sshkey.1747086242.txt.gz · Last modified: 2025/05/12 21:44 by justip6