[NBLUG/talk] Syntax of scp
The Micxz
an_email at micxz.com
Mon Mar 1 15:36:01 PST 2004
Or the fast way and saves disk space:
tar -cvzf - homes | ssh home "cat > homes.bk.tar.gz"
--
Micxz
Mitch Patenaude wrote:
> The tarball will have the same absolute or relative paths it was
> created with... so maybe
> you want to do something like
>
> $ cd $HOME
> $ tar cfvz /tmp/home.tgz .
> {......}
> $ scp /tmp/home.tgz otherhost:.
>
> Basically.. don't use an absolute path the home dir
>
> $ tar cfvs /tmp/home.tgz /home/melvyn
>
> because when you untar it, it will try to use the new path. I think
> there are arguments that will keep the path from being interpreted as
> absolute, and maybe that's the default behavior now. It used to be that
> absolute paths were default, and a security breach was possible if you
> could get root to untar a hostile file with (say) a new /etc/passwd in it.
>
> -- Mitch
>
>
> On Sunday, Feb 29, 2004, at 08:12 US/Pacific, Todd Cary wrote:
>
>> Mitch -
>>
>> My goal is to tar ( -czvf ) /home /etc/passwd and /etc/shadow, scp it
>> to my temporary computer that has a new Fedora Core 1 OS installed.
>> Then I want to untar the file and have the temporary computer handle
>> the work while I rebuild my production system.
>>
>> Never having done this before, I am not sure if the relative paths
>> will be restored when I untar the file.
>>
>> Todd
>>
>> Mitch Patenaude wrote:
>>
>>> scp has an argument structure that is (purposefully) the same (or
>>> really a subset) as that of rcp. It was thought of as a drop-in
>>> replacement.
>>>
>>> So.. the syntax for destination (or source) files is
>>>
>>> [[user@]hostname:]path
>>>
>>> without the syntactic key of the :at the end, the parser was treating
>>> it just like a filename since 192.168.0.12 is valid file name. If
>>> neither of the source and destination are "remote", it behaves just
>>> like cp.
>>>
>>> And you can specify multiple sources and one destination, all on
>>> different machines, e.g.:
>>>
>>> scp calisto:index.html john at europa:/tmp/logo.png
>>> widgets at www.example.com:public_html/NewProducts/.
>>>
>>> If you specify more than one host.. the authentications happen in the
>>> order they appear on the command line. I like to set up
>>> $HOME/known_hosts with keys so that authentication is automatic, but
>>> it will fall back on password authenication.
>>>
>>> Something else to note: If there is no path, or if the path is
>>> relative, then it's interpreted as relative to the home directory of
>>> the user. If the file isn't in the home dir, you can use an absolute
>>> path.
>>>
>>> -- Mitch
>>>
>>> _______________________________________________
>>> talk mailing list
>>> talk at nblug.org
>>> http://nblug.org/mailman/listinfo/talk
>>>
>>>
>>
>> --
>>
>> _______________________________________________
>> talk mailing list
>> talk at nblug.org
>> http://nblug.org/mailman/listinfo/talk
>>
>
> _______________________________________________
> talk mailing list
> talk at nblug.org
> http://nblug.org/mailman/listinfo/talk
--
Micxz
More information about the talk
mailing list