[KLUG Members] remote copy of /homes directory
bill
bill at billtron.com
Fri Dec 3 19:39:38 EST 2004
On Fri, 2004-12-03 at 16:48, Adam Tauno Williams wrote:
> > If I wanted to remotely copy (rcp) the /homes directory from a host, how
> > could I do it without logging in as root?
> > scp WhatUserHere at myhost:/homes /mylocaldirectory
>
> You probably want the "-r" option for recursive operation.
>
> > If I use a normal user, that user would only have access to one home
> > directory (their own).
>
> Yep.
>
> > If I use root it somehow doesn't seem like I'm doing it securely (should
> > you ever remotely log in directly as root?).
>
> Depends.
>
> Do you care about file permissions/ownership? If so better to use
> something like tar.
>
> You can:
> ssh root@{remotehost} "tar cf - /home | ssh root@{localhost} \"tar -C/
> -xf - \" "
Wow, that's pretty cool. You can start an ssh connection and have the
remote computer run a command all on one line. In your case the tar
command outputs to console (-c), but that output is piped to an ssh
connection back to your computer (or some third computer). The third
computer then UNtars the file, essentially making a duplicate of the
/home filesystem.
Would there be a way to use the SSH tunnel to the third computer simply
save the file instead of extracting it?
More information about the Members
mailing list