Gnu tar happily connects to remote hosts, depending on filename

https://news.ycombinator.com/item?id=6400499
by fooyc • 13 years ago
9 5 13 years ago

Today I Learned:

    $ tar xvzf wtf:foo.tar
    tar (child): Cannot connect to wtf: resolve failed
Apparently the ":" in the filename tells tar to connect to "wtf" using the "rsh" command (aliased to "ssh").

There is no mention of this in the man page: http://linuxcommand.org/lc3_man_pages/tar1.html ; apart from the rather surprising --rsh-command and --rmt-command options.

This actually is documented in the "info" pages:

http://www.gnu.org/software/tar/manual/tar.html#SEC152 :

    ‘-f [hostname:]file’
    ‘--file=[hostname:]file’

        Use archive file or device file on hostname.

    If the file name contains a ‘:’, it is interpreted as ‘hostname:file
    name’. If the hostname contains an at sign (‘@’), it is treated as
    ‘user@hostname:file name’. In either case, tar will invoke the command
    rsh (or remsh) to start up an /usr/libexec/rmt on the remote machine
Isn't it dangerous that a random filename could trigger "tar" to connect to remote hosts ?

Related Stories

Loading related stories...

Source preview

news.ycombinator.com