[comp.unix.questions] rcp as guest

ddgg0881@uxa.cso.uiuc.edu (07/18/89)

 I would like to be able to recursively copy directories from a
remote machine onto my local machine. The problem is that I can
only log onto the remote machine as guest and I would like to 
write onto my own machine with super user authority. To use rcp,
though, I have use the same logon on my local machine as I have on the 
remote machine so I can only write to my own machine as guest. Does 
anyone know of a solution to this problem?

Dale Gerdemann
University of Ill, Beckman Institute
dale@tarski.cogsci.uiuc.edu

pvo@uther.CS.ORST.EDU (Paul V O'Neill) (07/20/89)

In article <113700007@uxa.cso.uiuc.edu> ddgg0881@uxa.cso.uiuc.edu writes:
>
>   [guest@hostA wants to rcp (recursively) to hostB as root]


on hostB:

	/.rhosts contains the line:
	hostA guest

on hostA:

	/usr/local/bin/rtar = 
	#!/bin/csh
	tar cvfb - 20 $1 | rsh $2 "cd $3; tar xfBp -"

	cd to one directory above the directory you want to copy,
	type the command:

	rtar SourceDir 'hostA -l root' DestDir

BE CAREFUL!! Escape *'s ~'s and other characters that the shell would expand.

SourceDir will end up in DestDir.

This is actually better than rcp'ing, as symlinks are not followed and
modification times are preserved.



Paul O'Neill                 pvo@oce.orst.edu
Coastal Imaging Lab
OSU--Oceanography
Corvallis, OR  97331         503-737-3251

chris@mimsy.UUCP (Chris Torek) (07/24/89)

[note that rcp and rsh here refer to the 4BSD utilities]

In article <113700007@uxa.cso.uiuc.edu> ddgg0881@uxa.cso.uiuc.edu writes:
>... To use rcp, though, I have use the same logon on my local machine
>as I have on the remote machine ....

Someone else has already suggested using rsh and tar instead of rcp.
To complete the answer, though, it is possible (even easy) to rcp files
across different account names.  For instance, although I am
`chris@umdhost.umd.edu', I am `torek@ucbhost.berkeley.edu'; to copy
files between here and Berkeley, I could run

	[umd1] rcp torek@ucbhost.berkeley.edu:files dir
	[umd2] rcp files torek@ucbhost.berkeley.edu:dir
	[umd3] rlogin ucbhost.berkeley.edu -l torek
	[ucb1] rcp chris@umdhost.umd.edu:files dir
	[ucb2] rcp files chris@umdhost.umd.edu:files

Note that for this to work, chris@umdhost.umd.edu must be in the
.rhosts file of torek@ucbhost.berkeley.edu (for rcp run from umdhost),
and torek@ucbhost.berkeley.edu must be in the .rhosts file of
chris@umdhost.umd.edu (for rcp run from ucbhost).  (These entries tend
not to be there, for security reasons.  We will all run Kerberos soon
and use a different approach entirely anyway.)

Note also that 4.2BSD had a different syntax: rather than
`me@host:file', one had to write `host.me:file'.  The period was found
by scanning backwards from the colon, so that `host.long.name.me'
worked.  Of course, this meant that even where one had the same login
name on hosts in different domains, one had to type one's own
name---running like

	rcp ucbhost.berkeley.edu:file dir

would try to connect to `ucbhost.berkeley' as user `edu', rather
than `ucbhost.berkeley.edu' as user `$USER'.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@mimsy.umd.edu	Path:	uunet!mimsy!chris

ddgg0881@uxa.cso.uiuc.edu (07/29/89)

In article <113700007@uxa.cso.uiuc.edu> I write:

>
>
> I would like to be able to recursively copy directories from a
>remote machine onto my local machine. The problem is that I can
>only log onto the remote machine as guest and I would like to 
>write onto my own machine with super user authority. To use rcp,
>though, I have use the same logon on my local machine as I have on the 
>remote machine so I can only write to my own machine as guest. Does 
>anyone know of a solution to this problem?

Thanks to everyone who sent answers to this question. Given the variety
of answers I got, it seems fair to say that this is a genuinely confusing
point.  The answer is probably in the manual but rcp is one of those
things ofter missing from manuals (e.g. absent  from my manual for my
version of *ix). To add to the confusion there has been a change of
syntax in the most recent version of rcp. Of all the answers I got,
the following is the only one that seemed entirely correct:

>Say what ?  Rcp supports `user@machine:file' (or `machine.user:file' in 4.2
>based systems).  What you need to do is on the remote machine as guest, creat
>a file called `.rhosts' with `local-machine-name root', the run e.g.
>
>	rcp -rp guest@remote-machine:dir .
>
>Remember to remove the `.rhosts' file once you've done with it.
>
>Rob
>-- 
>UUCP:   ...!mcvax!ukc!warwick!cudcv	PHONE:  +44 203 523037
>JANET:  cudcv@uk.ac.warwick             ARPA:   cudcv@warwick.ac.uk
>Rob McMahon, Computing Services, Warwick University, Coventry CV4 7AL, England


Dale Gerdemann
U. of Ill, Beckman Institute
dale@tarski.cogsci.uiuc.edu