GNU tar and remote hosts

A little tip that maybe it’s not so well known. When passing an argument to the -f option (–file) to GNU tar, you can specify a remote address using the standard colon format. For example

tar cfv user@remotehost:/path/to/tar /files/to/archive

will try to connect to remotehost via SSH and authenticate as user (asking the password or using your preferred ssh auth method). Obviously you have to have rsh on your local machine and an sftp capable server on the other side.

Advertisements

3 thoughts on “GNU tar and remote hosts

  1. Well, for example combined with a passwordless key access to a remote host, you have a secure way to remotely backup your data through the Internet with a oneliner.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s