LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-30-2007, 08:20 PM   #1
fw12
Member
 
Registered: Mar 2006
Distribution: Fedora core, Ubuntu
Posts: 175

Rep: Reputation: 31
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.
 
Old 11-30-2007, 09:26 PM   #2
damonhart
LQ Newbie
 
Registered: Nov 2007
Posts: 22

Rep: Reputation: 15
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.)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't SSH to remote machine: Connection closed by remote host Avatar Linux - Networking 35 10-23-2017 12:21 AM
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 12:23 PM
Complicated one: MySQL, rsync, remote machine, local machine daiver Linux - General 2 02-27-2006 12:14 PM
how to open a dilog on local machine when i do ssh to remote machine fahad26 Programming 3 05-03-2005 07:39 PM
using linux to redirect remote vpn traffic to another remote machine brb5548 Linux - Networking 0 06-28-2003 09:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration