I just recently started a VPS using Fedora. Upon creation of the VPS I was asked if I wanted to use SSH keys (which I did). Now, to connect as root to the VPS, I do not need to enter a password.
Now I want to create a pair (or just reuse the same key) for user1 for use while using ssh. First I tried to paste the id_rsa.pub folder while logged in as user1 in the ~/.ssh/ folder.
- Still asks for password upon ssh
Then I added a authorized_keys file that was identical to the id_rsa.pub file.
- Still asks for password upon ssh
Then I chmod the permissions to the .ssh folder to 644 however, when I try to ssh login as user1.
- Still asks for password upon ssh
How can I use the same public ssh key on a user account that I have for the root account. Where to I put these files, and what is the difference between having a id_rsa.pub file and an authorized_keys file?
.sshdirectory must be 700 (drwx------), theauthorized_keysfile must be 644 or 640 or 600 (-rw-r--r--or-rw-r-----or-rw-------), and your home directory must not be group-writable. If you can't figure out whether the permissions are correct, post the output ofls -ld ~ ~/.ssh ~/.ssh/authorized_keyson the server andls -ld ~ ~/.ssh ~/.ssh/id_rsaon the client. – Gilles 'SO- stop being evil' Apr 10 '15 at 00:18.sshdirectory. That fixed it.Also, can you tell me what file actually gets checked? is it the
– Startec Apr 10 '15 at 00:22authorized_keysor theid_rsa.pubfile?id_rsa.pubfile is never read byssh(but it's useful to keep it around to easily determine where a public key is coming from). The server readsauthorized_keysand the client needsid_rsa. – Gilles 'SO- stop being evil' Apr 10 '15 at 00:29id_rsa.pubandauthorized_keysfiles correct? Issshsomehow able to parse the files to read the different keys? – Startec Apr 10 '15 at 00:39authorized_keys. To authorize multiple keys, just append the.pubfiles to it. Each line in that file represents one authorized key. – Gilles 'SO- stop being evil' Apr 10 '15 at 00:41