LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Rsync RSA keys for two different users (https://www.linuxquestions.org/questions/linux-newbie-8/rsync-rsa-keys-for-two-different-users-4175490335/)

arcolombo698 01-06-2014 01:22 PM

Rsync RSA keys for two different users
 
Hello.

I am trying to set up an Rsync transfer to a remote server.

I had already created my RSA-pub authorization keys, and am now ready to transfer an rsa key into the remote server.

here is the problem:
The remote server is shared by many users. I cd into the ~.ssh file and found that another rsa-pub key already exists from another user.

what will happen if I transfer my rsa-pub key into the .ssh file when there exists already another?

Thank you very much

suicidaleggroll 01-06-2014 01:46 PM

You don't put your authorization key file itself into ~/.ssh, you tack the line contained in your key file into the ~/.ssh/authorized_keys file on the destination machine. There can be as many as you want in that file.

The key file you're seeing in ~/.ssh on that machine is for a user who is already logged into that machine and is trying to ssh elsewhere. In other words, that's that machine's outgoing key, the authorized incoming keys are stored in ~/.ssh/authorized_keys or authorized_keys2.

arcolombo698 01-06-2014 05:10 PM

rsa_pub
 
So I was following the directions from
http://wiki.linuxquestions.org/wiki/...reate_ssh_keys

and when I copied over the rsa_pub (under the directions 5th copy)
I overwrote an rsa_pub file that existed there previously.

Is this problematic? How do I fix this issue?

Thank you

suicidaleggroll 01-06-2014 11:44 PM

Somebody else would have to answer that. I bet you can re-generate the public key from the private key with some openssl command, but I don't know what it is.

In the future, don't follow those instructions. Just open two terminal windows. In one open up your public key in a text editor, in the other you should ssh to the destination machine and open up the ~/.ssh/authorized_keys or authorized_keys2 file in a text editor, then just copy and paste your public key over. You can do it in one command with:
Code:

cat ~/.ssh/id_dsa.pub | ssh -l <user> <remoteserver> "cat - >>.ssh/authorized_keys2"
but I find it faster to just open up two terminals and copy/paste than to type out that monstrosity.

lleb 01-07-2014 12:46 PM

Quote:

Originally Posted by arcolombo698 (Post 5093161)
So I was following the directions from
http://wiki.linuxquestions.org/wiki/...reate_ssh_keys

and when I copied over the rsa_pub (under the directions 5th copy)
I overwrote an rsa_pub file that existed there previously.

Is this problematic? How do I fix this issue?

Thank you

you didnt finish reading the link. step 5a talks about copy-id-ssh command and how to deal with it.

do NOT overwrite the rsa_pub on the remote server you are setting up the keys. from the local server do the following:

Code:

$ scp id_rsa.pub remote_server_user@remote_IP:/home/remote_server_user/.ssh/id_rsa.pub.foo
replace foo with what ever you want. then

Code:

$ ssh remote_server_user@remote_IP
--enter password when prompted--
$ cd /home/remote_server_user/.ssh
$ cat id_rsa.pub.foo >> authorized_keys
$ exit

finish with the link you have above.

P.S. I also added these instructions to that wiki link so others can be helped and hopefully avoid the pitfall you have been facing.


All times are GMT -5. The time now is 03:05 AM.