How to use sudo with rcp command to copy files from linux host to HP-UX host?

0

I'm having this issue where when I try to use sudo to rcp some files from a Linux host to an HP-UX host (note that the destination directory requires root access to write to), I get the following error from HP-UX's side:

LINUX HOST:/tmp/justin $ sudo rcp ./justin.txt HPUXHOST:/usr/local/bin
remshd: Login incorrect.

I should note that the passwords for the Linux host and the HP-UX host are different. The command doesn't seem to give me a chance to enter the proper HP-UX password and automatically defaults to this error.

Justin

Posted 2012-06-28T00:00:38.003

Reputation: 111

Are you sure that the HP-UX host allows remote root login? – Thor – 2012-06-28T00:03:09.413

Answers

2

"sudo" on this side doesn't give you root on that side. I think you want rcp ./justin.txt root@HPUXHOST:/usr/local/bin, but even then you'll need the root password on that side, and they will have to allow root remote connections, which is unlikely. It's safer (and more likely to work) if you just rcp it to somewhere neutral (like /var/tmp) on the remote side, and then log into the remote side and use sudo mv to put it in /usr/local/bin.

Paul Tomblin

Posted 2012-06-28T00:00:38.003

Reputation: 1 962

You don't want to enable rcp to receive as root, if you do get it to work then take a few minutes to disable it. Better to use scp as a non-root user on both sides and then sudo mv and chown appropriately on the other side. – Ram – 2012-07-11T01:03:12.793

Isn't that pretty much what I said? – Paul Tomblin – 2012-07-11T01:17:15.510

Pretty much - a reference to scp is informative so I added it; note that I up-voted your answer rather than make my own... – Ram – 2012-07-11T01:19:53.683

Ah, well if we're going to mention things that are better than what the op specified, I'd like to cast a vote for rsync. – Paul Tomblin – 2012-07-11T02:22:32.817

0

You can also use rsync instead to copy the files with sudo rsync -avz -e "ssh" --rsync-path="sudo rsync"

Scott W.

Posted 2012-06-28T00:00:38.003

Reputation: 31