public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user]  ssh and tar combined?
@ 2005-12-27 23:53 Mick
  2005-12-28  0:07 ` Lares Moreau
                   ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Mick @ 2005-12-27 23:53 UTC (permalink / raw
  To: gentoo-user

Hi All,

One day I hope to learn how to use ssh and the associated commands.  So far
I have been struggling just to copy a file from one box (192.168.0.3) to
another (192.168.0.2).  This is what I get, but and since I can't find the
'copied' file . . . I suspect it fails. I don't understand why:
==================================
# ssh root@192.168.0.3
Password: 
root@2[~]# scp -pv root@192.168.0.3:/mnt/sda14/sda10_home.tar .         
Executing: program /usr/bin/ssh host 192.168.0.3, user root, command scp -v
-p -                                                                                                  
f /mnt/sda14/sda10_home.tar
OpenSSH_3.8.1p1 Debian-8.sarge.4, OpenSSL 0.9.7e 25 Oct 2004
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: /etc/ssh/ssh_config line 33: Deprecated option
"RhostsAuthentication"
debug1: /etc/ssh/ssh_config line 37: Deprecated option "FallBackToRsh"
debug1: /etc/ssh/ssh_config line 38: Deprecated option "UseRsh"
debug1: Connecting to 192.168.0.3 [192.168.0.3] port 22.
debug1: Connection established.
debug1: read PEM private key done: type DSA
debug1: read PEM private key done: type RSA
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version
OpenSSH_3.8.1p1 De                                                                                                  
bian-8.sarge.4
debug1: match: OpenSSH_3.8.1p1 Debian-8.sarge.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.8.1p1 Debian-8.sarge.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '192.168.0.3' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue:
publickey,password,keyboard-interacti                                                                                                  
ve
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Trying private key: /root/.ssh/id_rsa
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
Password: 
debug1: Authentication succeeded (keyboard-interactive).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Sending command: scp -v -p -f /mnt/sda14/sda10_home.tar
Sending file modes: C0644 536002560 sda10_home.tar
sda10_home.tar                                100%  511MB  24.3MB/s   00:21    
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 21.5 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 0
root@2[~]# exit    
logout
Connection to 192.168.0.3 closed.
=========================================

Ideally I would like to connect and tar | scp the directories/files from one
box to another in a single motion.  Any advice to help me understand how to
make this work, or why the above attempt fails would be much appreciated.
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-27 23:53 [gentoo-user] ssh and tar combined? Mick
@ 2005-12-28  0:07 ` Lares Moreau
  2005-12-28  7:07   ` [gentoo-user] " Mick
  2005-12-28  2:27 ` [gentoo-user] " Ow Mun Heng
  2005-12-28  8:04 ` [gentoo-user] " Alexander Skwar
  2 siblings, 1 reply; 25+ messages in thread
From: Lares Moreau @ 2005-12-28  0:07 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1397 bytes --]

On Tue, 2005-12-27 at 23:53 +0000, Mick wrote:
> Hi All,
> 
> One day I hope to learn how to use ssh and the associated commands.  So far
> I have been struggling just to copy a file from one box (192.168.0.3) to
> another (192.168.0.2).  This is what I get, but and since I can't find the
> 'copied' file . . . I suspect it fails. I don't understand why:
> ==================================
> # ssh root@192.168.0.3
> Password: 
> root@2[~]# scp -pv root@192.168.0.3:/mnt/sda14/sda10_home.tar .         
--CUT---
> 
> Ideally I would like to connect and tar | scp the directories/files from one
> box to another in a single motion.  Any advice to help me understand how to
> make this work, or why the above attempt fails would be much appreciated.
> -- 
> Regards,
> Mick
> 

scp is used in the same manner you use cp. It seems that you have ssh'd
into your other box then are trying to scp to yourself.

try this.
comp1# scp root@<comp2>:/path/to/file.tar /path/to/local/
this will cp from <comp2> to <comp1> :)

-Lares


Lares Moreau <lares.moreau@gmail.com>  | LRU: 400755 http://counter.li.org
lares/irc.freenode.net                 |
Gentoo x86 Arch Tester                 |               ::0 Alberta, Canada
Public Key: 0D46BB6E @ subkeys.pgp.net |          Encrypted Mail Preferred
Key fingerprint = 0CA3 E40D F897 7709 3628  C5D4 7D94 483E 0D46 BB6E

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-27 23:53 [gentoo-user] ssh and tar combined? Mick
  2005-12-28  0:07 ` Lares Moreau
@ 2005-12-28  2:27 ` Ow Mun Heng
  2005-12-28  7:05   ` [gentoo-user] " Mick
  2005-12-28  8:04 ` [gentoo-user] " Alexander Skwar
  2 siblings, 1 reply; 25+ messages in thread
From: Ow Mun Heng @ 2005-12-28  2:27 UTC (permalink / raw
  To: gentoo-user

On Tue, 2005-12-27 at 23:53 +0000, Mick wrote:

> 
> Ideally I would like to connect and tar | scp the directories/files from one
> box to another in a single motion.  Any advice to help me understand how to
> make this work, or why the above attempt fails would be much appreciated.


Locallly :

tar lcf - . | (cd /other/area/store; tar -xpvf - )
tar lcf - /path/to/file | (cd /other/area/store; tar -xpvf - )

To specify directories or files to exclude, we can use the option "--
exclude"

tar --exclude File1 --exclude Dir1 -lcf - . | ( cd /other/area; tar
-xvpf - )

via SSH remotely :

tar -czf - /directory/to/copy | ssh systemB tar -xzvf - -C /tmp

How's that?? Bear in mind that SSH will use some overhead due to
encryption. (you can change the cipher to blowfish if you want/is not
that paranoid :-)




-- 
Ow Mun Heng
Gentoo/Linux on DELL D600 1.4Ghz 1.5GB RAM
98% Microsoft(tm) Free!! 
Neuromancer 10:27:28 up 1 day, 1:09, 6 users, load average: 0.73, 0.83,
1.09 


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [gentoo-user]  Re: ssh and tar combined?
  2005-12-28  2:27 ` [gentoo-user] " Ow Mun Heng
@ 2005-12-28  7:05   ` Mick
  0 siblings, 0 replies; 25+ messages in thread
From: Mick @ 2005-12-28  7:05 UTC (permalink / raw
  To: gentoo-user

Ow Mun Heng wrote:

> 
> Locallly :
> 
> tar lcf - . | (cd /other/area/store; tar -xpvf - )
> tar lcf - /path/to/file | (cd /other/area/store; tar -xpvf - )

Thanks, I've used that in the past but I could only get it to work in the
same (local) computer.

> 
> via SSH remotely :
> 
> tar -czf - /directory/to/copy | ssh systemB tar -xzvf - -C /tmp

If local box is 192.168.0.2 and remote box is 192.168.0.3 what should the
above paths look like?
  
> 
> How's that?? Bear in mind that SSH will use some overhead due to
> encryption. (you can change the cipher to blowfish if you want/is not
> that paranoid :-)

How do I change the encryption to blowfish?
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [gentoo-user]  Re: ssh and tar combined?
  2005-12-28  0:07 ` Lares Moreau
@ 2005-12-28  7:07   ` Mick
  2005-12-28  7:29     ` Mick
  0 siblings, 1 reply; 25+ messages in thread
From: Mick @ 2005-12-28  7:07 UTC (permalink / raw
  To: gentoo-user

Lares Moreau wrote:

> scp is used in the same manner you use cp. It seems that you have ssh'd
> into your other box then are trying to scp to yourself.

Hmm, I tried just scp (without first ssh-ing into the remote box) but
couldn't get it to work.

> try this.
> comp1# scp root@<comp2>:/path/to/file.tar /path/to/local/
> this will cp from <comp2> to <comp1> :)

Wey, hey!  It worked this time!!  :-D

Thank you very much!
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [gentoo-user]  Re: ssh and tar combined?
  2005-12-28  7:07   ` [gentoo-user] " Mick
@ 2005-12-28  7:29     ` Mick
  2005-12-28  8:19       ` Mariusz Pękala
  0 siblings, 1 reply; 25+ messages in thread
From: Mick @ 2005-12-28  7:29 UTC (permalink / raw
  To: gentoo-user

Mick wrote:

> Lares Moreau wrote:
> 
>> scp is used in the same manner you use cp. It seems that you have ssh'd
>> into your other box then are trying to scp to yourself.
> 
> Hmm, I tried just scp (without first ssh-ing into the remote box) but
> couldn't get it to work.
> 
>> try this.
>> comp1# scp root@<comp2>:/path/to/file.tar /path/to/local/
>> this will cp from <comp2> to <comp1> :)
> 
> Wey, hey!  It worked this time!!  :-D
> 
> Thank you very much!

Blast, spoke too soon.  When I tried to scp over the tar of the /var/tmp
partition it failed:
===============================
debug1: Sending command: scp -v -p -f /mnt/sda14/sda5_var.tmp
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Sink: scp: /mnt/sda14/sda5_var.tmp: not a regular file
scp: /mnt/sda14/sda5_var.tmp: not a regular file
debug1: channel 0: free: client-session, nchannels 1
debug1: fd 0 clearing O_NONBLOCK
debug1: fd 1 clearing O_NONBLOCK
debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 3.1 seconds
debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
debug1: Exit status 1
===============================

What does "not a regular file" mean? :=@
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-27 23:53 [gentoo-user] ssh and tar combined? Mick
  2005-12-28  0:07 ` Lares Moreau
  2005-12-28  2:27 ` [gentoo-user] " Ow Mun Heng
@ 2005-12-28  8:04 ` Alexander Skwar
  2005-12-28 14:22   ` John Jolet
  2 siblings, 1 reply; 25+ messages in thread
From: Alexander Skwar @ 2005-12-28  8:04 UTC (permalink / raw
  To: gentoo-user

Mick schrieb:

> Ideally I would like to connect and tar | scp the directories/files from one
> box to another in a single motion.

Use ssh instead:

tar | ssh user@host "cat > foo.tar"

Alexander Skwar
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  Re: ssh and tar combined?
  2005-12-28  7:29     ` Mick
@ 2005-12-28  8:19       ` Mariusz Pękala
  2005-12-28 15:39         ` Michael Kintzios
  0 siblings, 1 reply; 25+ messages in thread
From: Mariusz Pękala @ 2005-12-28  8:19 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1247 bytes --]

On 2005-12-28 07:29:31 +0000 (Wed, Dec), Mick wrote:
> Blast, spoke too soon.  When I tried to scp over the tar of the /var/tmp
> partition it failed:
> ===============================
> debug1: Sending command: scp -v -p -f /mnt/sda14/sda5_var.tmp
> debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
> Sink: scp: /mnt/sda14/sda5_var.tmp: not a regular file
> scp: /mnt/sda14/sda5_var.tmp: not a regular file
> debug1: channel 0: free: client-session, nchannels 1
> debug1: fd 0 clearing O_NONBLOCK
> debug1: fd 1 clearing O_NONBLOCK
> debug1: Transferred: stdin 0, stdout 0, stderr 0 bytes in 3.1 seconds
> debug1: Bytes per second: stdin 0.0, stdout 0.0, stderr 0.0
> debug1: Exit status 1
> ===============================
> 
> What does "not a regular file" mean? :=@

Do an 'ls -l /mnt/sda14/sda5_var.tmp and the first character on the left
will tell you what kind of file is this.

Not a regular file may mean: 
- 'l' = symbolic link
- 'd' = directory
- 'p' = pipe (fifo)
- 'b' = block device
- 'c' = character device

...i hope I didn't miss any?
See 'man ls' in Posix section: man -S 1p ls


-- 
No virus found in this outgoing message.
Checked by 'grep -i virus $MESSAGE'
Trust me.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-28  8:04 ` [gentoo-user] " Alexander Skwar
@ 2005-12-28 14:22   ` John Jolet
  2005-12-28 15:35     ` Michael Kintzios
  2005-12-30 15:21     ` Neil Bothwick
  0 siblings, 2 replies; 25+ messages in thread
From: John Jolet @ 2005-12-28 14:22 UTC (permalink / raw
  To: gentoo-user


On Dec 28, 2005, at 2:04 AM, Alexander Skwar wrote:

> Mick schrieb:
>
>> Ideally I would like to connect and tar | scp the directories/ 
>> files from one
>> box to another in a single motion.
>
> Use ssh instead:
>
> tar | ssh user@host "cat > foo.tar"
>
or ssh sourcebox "tar -czvf - /path/to/be/backed/up" | dd  
of=target.tar.gz

this will ssh into the other box, create the tar to stdout, pipe  
stdout from the ssh stream to dd, who's default input is stdin, and  
output the file.
> Alexander Skwar
> -- 
> gentoo-user@gentoo.org mailing list
>

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [gentoo-user]  ssh and tar combined?
  2005-12-28 14:22   ` John Jolet
@ 2005-12-28 15:35     ` Michael Kintzios
  2005-12-30 15:21     ` Neil Bothwick
  1 sibling, 0 replies; 25+ messages in thread
From: Michael Kintzios @ 2005-12-28 15:35 UTC (permalink / raw
  To: gentoo-user



> -----Original Message-----
> From: John Jolet [mailto:john@jolet.net] 
> Sent: 28 December 2005 14:22
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] ssh and tar combined?
> 
> 
> 
> On Dec 28, 2005, at 2:04 AM, Alexander Skwar wrote:
> 
> > Mick schrieb:
> >
> >> Ideally I would like to connect and tar | scp the directories/ 
> >> files from one
> >> box to another in a single motion.
> >
> > Use ssh instead:
> >
> > tar | ssh user@host "cat > foo.tar"
> >
> or ssh sourcebox "tar -czvf - /path/to/be/backed/up" | dd  
> of=target.tar.gz
> 
> this will ssh into the other box, create the tar to stdout, pipe  
> stdout from the ssh stream to dd, who's default input is stdin, and  
> output the file.

Thanks Alexander, I'll try it out when I get home.
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* RE: [gentoo-user]  Re: ssh and tar combined?
  2005-12-28  8:19       ` Mariusz Pękala
@ 2005-12-28 15:39         ` Michael Kintzios
  2005-12-28 18:31           ` [gentoo-user] " Mick
  0 siblings, 1 reply; 25+ messages in thread
From: Michael Kintzios @ 2005-12-28 15:39 UTC (permalink / raw
  To: gentoo-user



> -----Original Message-----
> From: Mariusz Pêkala [mailto:skoot@qi.pl] 
> Sent: 28 December 2005 08:20
> To: gentoo-user@lists.gentoo.org
> Subject: Re: [gentoo-user] Re: ssh and tar combined?
> 
> 
> On 2005-12-28 07:29:31 +0000 (Wed, Dec), Mick wrote:

> > What does "not a regular file" mean? :=@
> 
> Do an 'ls -l /mnt/sda14/sda5_var.tmp and the first character 
> on the left
> will tell you what kind of file is this.

I have a devilish suspicion that I have been trying to scp a symlink!
8-/  I think that I urgently need some sleep before I do something I
will soon regret.
-- 
Regards,
Mick


-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* [gentoo-user]  RE: Re: ssh and tar combined?
  2005-12-28 15:39         ` Michael Kintzios
@ 2005-12-28 18:31           ` Mick
  2005-12-28 23:00             ` Willie Wong
  0 siblings, 1 reply; 25+ messages in thread
From: Mick @ 2005-12-28 18:31 UTC (permalink / raw
  To: gentoo-user

Michael Kintzios wrote:

> 
> 
>> -----Original Message-----
>> From: Mariusz Pêkala [mailto:skoot@qi.pl]
>> Sent: 28 December 2005 08:20
>> To: gentoo-user@lists.gentoo.org
>> Subject: Re: [gentoo-user] Re: ssh and tar combined?
>> 
>> 
>> On 2005-12-28 07:29:31 +0000 (Wed, Dec), Mick wrote:
> 
>> > What does "not a regular file" mean? :=@
>> 
>> Do an 'ls -l /mnt/sda14/sda5_var.tmp and the first character
>> on the left
>> will tell you what kind of file is this.

OK, I am back at home now and have checked.  It is a normal directory with
normal files in it (well, it has ccache, kdecache, portage and the tmp
symlink).  So I am at a loss as to why it won't copy over.  Any ideas?
-- 
Regards,
Mick

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  RE: Re: ssh and tar combined?
  2005-12-28 18:31           ` [gentoo-user] " Mick
@ 2005-12-28 23:00             ` Willie Wong
  2005-12-29  0:32               ` John Jolet
  0 siblings, 1 reply; 25+ messages in thread
From: Willie Wong @ 2005-12-28 23:00 UTC (permalink / raw
  To: gentoo-user

On Wed, Dec 28, 2005 at 06:31:48PM +0000, Penguin Lover Mick squawked:
> >> On 2005-12-28 07:29:31 +0000 (Wed, Dec), Mick wrote:
> > 
> >> > What does "not a regular file" mean? :=@
> >> 
> >> Do an 'ls -l /mnt/sda14/sda5_var.tmp and the first character
> >> on the left
> >> will tell you what kind of file is this.
> 
> OK, I am back at home now and have checked.  It is a normal directory with
> normal files in it (well, it has ccache, kdecache, portage and the tmp
> symlink).  So I am at a loss as to why it won't copy over.  Any ideas?

Directories need the -r option for recursive copying.

W
-- 
Chocolate has many preservatives.  Preservatives make you look younger.
Sortir en Pantoufles: up 46 days, 15:21
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  RE: Re: ssh and tar combined?
  2005-12-28 23:00             ` Willie Wong
@ 2005-12-29  0:32               ` John Jolet
  0 siblings, 0 replies; 25+ messages in thread
From: John Jolet @ 2005-12-29  0:32 UTC (permalink / raw
  To: gentoo-user


On Dec 28, 2005, at 5:00 PM, Willie Wong wrote:

> On Wed, Dec 28, 2005 at 06:31:48PM +0000, Penguin Lover Mick squawked:
>>>> On 2005-12-28 07:29:31 +0000 (Wed, Dec), Mick wrote:
>>>
>>>>> What does "not a regular file" mean? :=@
>>>>
>>>> Do an 'ls -l /mnt/sda14/sda5_var.tmp and the first character
>>>> on the left
>>>> will tell you what kind of file is this.
>>
>> OK, I am back at home now and have checked.  It is a normal  
>> directory with
>> normal files in it (well, it has ccache, kdecache, portage and the  
>> tmp
>> symlink).  So I am at a loss as to why it won't copy over.  Any  
>> ideas?
>
> Directories need the -r option for recursive copying.
>
unless you are taring them.
> W
> -- 
> Chocolate has many preservatives.  Preservatives make you look  
> younger.
> Sortir en Pantoufles: up 46 days, 15:21
> -- 
> gentoo-user@gentoo.org mailing list
>

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-28 14:22   ` John Jolet
  2005-12-28 15:35     ` Michael Kintzios
@ 2005-12-30 15:21     ` Neil Bothwick
  2005-12-30 15:44       ` John Jolet
  2005-12-30 17:58       ` Alexander Skwar
  1 sibling, 2 replies; 25+ messages in thread
From: Neil Bothwick @ 2005-12-30 15:21 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

On Wed, 28 Dec 2005 08:22:26 -0600, John Jolet wrote:

> or ssh sourcebox "tar -czvf - /path/to/be/backed/up" | dd  
> of=target.tar.gz

tar outputs to stdout be default, so "-f -" is redundant, as is the use
of dd. All you need is

ssh hostname tar cf /source/path >backup.tar.gz


-- 
Neil Bothwick

Whats the difference between a magician and a brothel?
One has a cunning array of stunts,

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-30 15:21     ` Neil Bothwick
@ 2005-12-30 15:44       ` John Jolet
  2005-12-30 16:09         ` Neil Bothwick
  2005-12-30 17:58       ` Alexander Skwar
  1 sibling, 1 reply; 25+ messages in thread
From: John Jolet @ 2005-12-30 15:44 UTC (permalink / raw
  To: gentoo-user


On Dec 30, 2005, at 9:21 AM, Neil Bothwick wrote:

> On Wed, 28 Dec 2005 08:22:26 -0600, John Jolet wrote:
>
>> or ssh sourcebox "tar -czvf - /path/to/be/backed/up" | dd
>> of=target.tar.gz
>
> tar outputs to stdout be default, so "-f -" is redundant, as is the  
> use
> of dd. All you need is
>
> ssh hostname tar cf /source/path >backup.tar.gz
>
hmm, I'm not sure this behavior is consistent across all versions of  
tar and all versions of ssh.  I could be wrong, but the process I  
outlined will work on linux, aix, solaris, bsd, at least (those are  
the ones i've tested).  but hey, I could be wrong...just because  
method a works doesn't mean it's the only method...that's the beauty  
of unix.
>
> -- 
> Neil Bothwick
>
> Whats the difference between a magician and a brothel?
> One has a cunning array of stunts,

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-30 15:44       ` John Jolet
@ 2005-12-30 16:09         ` Neil Bothwick
  2005-12-30 18:04           ` Alexander Skwar
  0 siblings, 1 reply; 25+ messages in thread
From: Neil Bothwick @ 2005-12-30 16:09 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 617 bytes --]

On Fri, 30 Dec 2005 09:44:09 -0600, John Jolet wrote:

> > tar outputs to stdout be default, so "-f -" is redundant, as is the  
> > use
> > of dd. All you need is
> >
> > ssh hostname tar cf /source/path >backup.tar.gz
> >
> hmm, I'm not sure this behavior is consistent across all versions of  
> tar and all versions of ssh. 

The part about stdout being the default is consistent, -f overrides the
default. To maintain consistency across ssh versions, it may be safer to
use

ssh >backup.tar.gz hostname "tar cf /source/path"


-- 
Neil Bothwick

Windows95 - crash compatible on Windows 3.x

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-30 15:21     ` Neil Bothwick
  2005-12-30 15:44       ` John Jolet
@ 2005-12-30 17:58       ` Alexander Skwar
  2005-12-31 14:26         ` Neil Bothwick
  1 sibling, 1 reply; 25+ messages in thread
From: Alexander Skwar @ 2005-12-30 17:58 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick schrieb:
> On Wed, 28 Dec 2005 08:22:26 -0600, John Jolet wrote:
> 
>> or ssh sourcebox "tar -czvf - /path/to/be/backed/up" | dd  
>> of=target.tar.gz
> 
> tar outputs to stdout be default,

Not always.

> as is the use
> of dd.

Yes.

Alexander Skwar
-- 
Alexander Skwar
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-30 16:09         ` Neil Bothwick
@ 2005-12-30 18:04           ` Alexander Skwar
  0 siblings, 0 replies; 25+ messages in thread
From: Alexander Skwar @ 2005-12-30 18:04 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick schrieb:
> On Fri, 30 Dec 2005 09:44:09 -0600, John Jolet wrote:
> 
>> > tar outputs to stdout be default, so "-f -" is redundant, as is the  
>> > use
>> > of dd. All you need is
>> >
>> > ssh hostname tar cf /source/path >backup.tar.gz
>> >
>> hmm, I'm not sure this behavior is consistent across all versions of  
>> tar and all versions of ssh. 
> 
> The part about stdout being the default is consistent,

No, it's not. By default, tar writes to a tape device.

> To maintain consistency across ssh versions, it may be safer to
> use
> 
> ssh >backup.tar.gz hostname "tar cf /source/path"

Uh?

alexander@blatt /tmp $ ssh > t server "tar cf /tmp/."
alexander@server's password:
tar: Cowardly refusing to create an empty archive
Try `tar --help' or `tar --usage' for more information.

Ah, You wanted to leave out the "f" :)

But why should 'ssh > backup.tar hostname "tar c /source/path"'
be more consistent across *SSH* versions than
'ssh hostname "tar c /source/path" > backup.tar'?
Isn't that just a question wrt. the shell?

Alexander Skwar
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-30 17:58       ` Alexander Skwar
@ 2005-12-31 14:26         ` Neil Bothwick
  2005-12-31 14:53           ` John Jolet
                             ` (2 more replies)
  0 siblings, 3 replies; 25+ messages in thread
From: Neil Bothwick @ 2005-12-31 14:26 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 349 bytes --]

On Fri, 30 Dec 2005 18:58:17 +0100, Alexander Skwar wrote:

> > tar outputs to stdout by default,
> 
> Not always.

From man tar

-f, --file [HOSTNAME:]F 
 use archive file or device F (default "-", meaning stdin/stdout)

So "-f -" is unnecessary, but harmless.


-- 
Neil Bothwick

teG I sdrawkcaB eroM ehT oG I sdrawroF eroM ehT

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-31 14:26         ` Neil Bothwick
@ 2005-12-31 14:53           ` John Jolet
  2005-12-31 19:52             ` Neil Bothwick
  2005-12-31 14:55           ` Steve Evans
  2005-12-31 21:40           ` Alexander Skwar
  2 siblings, 1 reply; 25+ messages in thread
From: John Jolet @ 2005-12-31 14:53 UTC (permalink / raw
  To: gentoo-user


On Dec 31, 2005, at 8:26 AM, Neil Bothwick wrote:

> On Fri, 30 Dec 2005 18:58:17 +0100, Alexander Skwar wrote:
>
>>> tar outputs to stdout by default,
>>
>> Not always.
>
> From man tar
>
> -f, --file [HOSTNAME:]F
>  use archive file or device F (default "-", meaning stdin/stdout)
>
> So "-f -" is unnecessary, but harmless.
>
yes, this is a style question here.  I always prefer to be explicit,  
where I can.  Inevitably, in this business, you move on and someone  
will have to come behind and understand your scripts.  when you're  
looking at a long line embedded in a script, it's SO much easier to  
debug when the stdout is explicitly listed, than assumed.  This also  
allows for changes in default behavior.  Such practices become  
habit.  But you are correct, today this -f - is unnecessary.   
Tomorrow?  who knows what decisions might be made regarding default  
output.  My point is, being precise costs nothing... nothing but a  
few keystrokes.
>
> -- 
> Neil Bothwick
>
> teG I sdrawkcaB eroM ehT oG I sdrawroF eroM ehT

-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-31 14:26         ` Neil Bothwick
  2005-12-31 14:53           ` John Jolet
@ 2005-12-31 14:55           ` Steve Evans
  2005-12-31 15:16             ` John Jolet
  2005-12-31 21:40           ` Alexander Skwar
  2 siblings, 1 reply; 25+ messages in thread
From: Steve Evans @ 2005-12-31 14:55 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 2080 bytes --]

On Saturday 31 December 2005 14:26, Neil Bothwick wrote:
> On Fri, 30 Dec 2005 18:58:17 +0100, Alexander Skwar wrote:
> > > tar outputs to stdout by default,
> >
> > Not always.
>
> From man tar
>
> -f, --file [HOSTNAME:]F
>  use archive file or device F (default "-", meaning stdin/stdout)
>
> So "-f -" is unnecessary, but harmless.

That is true for GNU tar, but not for other versions, so specifying "-f -" is 
the safest solution. For example the man page tar on Solaris 2.8 says:

     f     File. Use the tarfile argument  as  the  name  of  the
           tarfile.  If  f  is specified, /etc/default/tar is not
           searched. If f is omitted, tar  will  use  the  device
           indicated  by  the  TAPE environment variable, if set;
           otherwise, it will use the default values  defined  in
           /etc/default/tar.  If  the name of the tarfile is '-',
           tar writes to the standard output or  reads  from  the
           standard  input,  whichever is appropriate. tar can be
           used as the head or tail of a pipeline. tar  can  also
           be used to move hierarchies with the command:

           example% cd fromdir; tar cf - .| (cd todir; tar xfBp -)

The file /etc/default/tar contains a list of tape devices. So on Solaris 2.8 
if -f is not specified and $TAPE is not set, which it isn't by default, then 
tar will use a tape device *not* stdin/stdout

Steve
-- 
____________________________________________________________________
Steve Evans            E-mail: mailto:stevee@gorbag.com
                       WEB:    http://www.gorbag.com
Registered Linux user #217906: http://counter.li.org
Public Encryption Key:         http://www.gorbag.com/public-key.html
____________________________________________________________________

Now playing: Nina Simone - It might as well be spring

2.6.14-gentoo-r5 Intel(R) Pentium(R) 4 CPU 3.00GHz GNU/Linux

 14:50:29 up 2 days, 21:41,  6 users,  load average: 0.21, 0.14, 0.14

I didn't know he was dead; I thought he was British.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-31 14:55           ` Steve Evans
@ 2005-12-31 15:16             ` John Jolet
  0 siblings, 0 replies; 25+ messages in thread
From: John Jolet @ 2005-12-31 15:16 UTC (permalink / raw
  To: gentoo-user

>
> The file /etc/default/tar contains a list of tape devices. So on  
> Solaris 2.8
> if -f is not specified and $TAPE is not set, which it isn't by  
> default, then
> tar will use a tape device *not* stdin/stdout
>
> Steve
> -- 
>
Thanks, Steve.  This is the point I was trying to make, but I'm at  
home with only linux and mac boxes... My point was if you specify the  
arguments you want, every time, you don't usually have to stop and  
wonder what the default behavior is on a given platform.  Not a  
problem if you're always on linux or know for sure that you're  
hitting gnu tar.  But for those of us who support a variety of  
platforms, not making assumptions about defaults is a good habit to  
get into (not speaking only of tar).
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-31 14:53           ` John Jolet
@ 2005-12-31 19:52             ` Neil Bothwick
  0 siblings, 0 replies; 25+ messages in thread
From: Neil Bothwick @ 2005-12-31 19:52 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 441 bytes --]

On Sat, 31 Dec 2005 08:53:45 -0600, John Jolet wrote:

> But you are correct, today this -f - is unnecessary.   
> Tomorrow?  who knows what decisions might be made regarding default  
> output.  My point is, being precise costs nothing... nothing but a  
> few keystrokes.

That's a fair point. The main reason for my initial reply was to comment
on your use of dd.


-- 
Neil Bothwick

Echo > Speak: "Whale oil beef hooked"

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 25+ messages in thread

* Re: [gentoo-user]  ssh and tar combined?
  2005-12-31 14:26         ` Neil Bothwick
  2005-12-31 14:53           ` John Jolet
  2005-12-31 14:55           ` Steve Evans
@ 2005-12-31 21:40           ` Alexander Skwar
  2 siblings, 0 replies; 25+ messages in thread
From: Alexander Skwar @ 2005-12-31 21:40 UTC (permalink / raw
  To: gentoo-user

Neil Bothwick schrieb:
> On Fri, 30 Dec 2005 18:58:17 +0100, Alexander Skwar wrote:
> 
>> > tar outputs to stdout by default,
>> 
>> Not always.
> 
> From man tar

So, why do you suppose that the command is called
"tape (file) archiver"?

While you're right as far as GNU tar is concerned,
you're wrong as far as the default of tar is concerned.

Eg. see the man page of tar on hp-ux, <http://docs.hp.com/en/B2355-90690/tar.1.html>:

| f	 	
| Use the next arg argument as the name of the archive instead
| of the default, /dev/rmt/0m.

Or Solaris 10 <http://docs.sun.com/app/docs/doc/816-5165/6mbb0m9u1?q=tar&a=view>:

| f
|
|     File. Use the tarfile argument as the name of the tarfile. If
|     is specified, /etc/default/tar is not searched. If f is omitted,
|     tar will use the device indicated by the TAPE environment variable,
|     if set. Otherwise, tar will use the default values defined in
|     /etc/default/tar

> So "-f -" is unnecessary, but harmless.

No, "f" is necessary if you don't wish to rely on unknown
defaults. Even with GNU tar, you don't know FOR SURE if
"-f -" is the default. Who knows? Maybe DEFAULT_ARCHIVE
was set to something else while building?

Alexander Skwar
-- 
gentoo-user@gentoo.org mailing list



^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2005-12-31 21:42 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-12-27 23:53 [gentoo-user] ssh and tar combined? Mick
2005-12-28  0:07 ` Lares Moreau
2005-12-28  7:07   ` [gentoo-user] " Mick
2005-12-28  7:29     ` Mick
2005-12-28  8:19       ` Mariusz Pękala
2005-12-28 15:39         ` Michael Kintzios
2005-12-28 18:31           ` [gentoo-user] " Mick
2005-12-28 23:00             ` Willie Wong
2005-12-29  0:32               ` John Jolet
2005-12-28  2:27 ` [gentoo-user] " Ow Mun Heng
2005-12-28  7:05   ` [gentoo-user] " Mick
2005-12-28  8:04 ` [gentoo-user] " Alexander Skwar
2005-12-28 14:22   ` John Jolet
2005-12-28 15:35     ` Michael Kintzios
2005-12-30 15:21     ` Neil Bothwick
2005-12-30 15:44       ` John Jolet
2005-12-30 16:09         ` Neil Bothwick
2005-12-30 18:04           ` Alexander Skwar
2005-12-30 17:58       ` Alexander Skwar
2005-12-31 14:26         ` Neil Bothwick
2005-12-31 14:53           ` John Jolet
2005-12-31 19:52             ` Neil Bothwick
2005-12-31 14:55           ` Steve Evans
2005-12-31 15:16             ` John Jolet
2005-12-31 21:40           ` Alexander Skwar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox