LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Writing to a remote machine without password (https://www.linuxquestions.org/questions/linux-general-1/writing-to-a-remote-machine-without-password-603637/)

fw12 11-30-2007 08:20 PM

Writing to a remote machine without password
 
I'm setting up a system that will transfer files
from
COMPUTER1
to
CCOMPUTER2
without a password.

I created pair of keys on COMPUTER1.
Moved the public key to COMPUTER2 and added it to /root/.ssh/authorized_keys

Now what do I need to do next for COMPUTER2 to allow COMPUTER1 to write to a particular folder on COMPUTER2.

Example I want to do something like this:

scp /home/user/filename user@COMPUTER2:/home/user/

In other words, write the file "/home/user/filename" to "/home/user/" on COMPUTER2.

TIA.

damonhart 11-30-2007 09:26 PM

With the public key from root@COMPUTER1 placed in COMPUTER2:/root/.ssh/authorized_keys, you should be able to use almost exactly your desired command, just change:

scp /home/user/filename user@COMPUTER2:/home/user/

to

scp /home/user/filename root@COMPUTER2:/home/user/

This reflects the fact that you've placed your public key in COMPUTER2:/root/.ssh/authorized_keys which gives you public key (vs password) access on COMPUTER2 as root (not user)

There's probably a gotcha here. While you'll be able to copy the file using the above, it will be created by and owned by root. The default permissions mean this file is likely unreadable, unwritable or both by user on COMPUTER2. If this isn't what you want, you may want to place the public key in ~user/.ssh/authorized_keys (/home/user/.ssh/authorized_keys) and then use your orignal command which then creates the file as user on COMPUTER2 (i.e. owned by user with default permissions.)


All times are GMT -5. The time now is 10:15 PM.