# [solved] tar over an ssh'ed network connection failed

## toralf

I know that this worked in the past (hardened amd64 host, x86 kvm) to unpack a new kernel from a local git tree to a kvm machine, but now it fails :

```
$ git archive --prefix linux-4.7.x/ v4.7 | (ssh root@n22kvm; cd /usr/src/; sudo tar -tf- 1>/dev/null)

Pseudo-terminal will not be allocated because stdin is not a terminal.

-bash: line 1: pax_global_header00006660000000000000000000000064127452127060014520gustar00rootroot0000000000000052: command not found

-bash: line 2: syntax error near unexpected token `newline'

-bash: line 2: `linux-4.7.x/000077500000000000000000000000001274521270600127775ustar00rootroot00000000000000linux-4.7.x/.get_maintainer.ignore000066400000000000000000000000371274521270600172500ustar00rootroot00000000000000Christoph Hellwig <hch@lst.de>'

tar: This does not look like a tar archive

tar: Skipping to next header

tar: Exiting with failure status due to previous errors
```

It works fine for the local host:

```
$ git archive --prefix linux-4.7.x/ v4.7 | (cd /usr/src/; sudo tar -tf- 1>/dev/null)
```

Now I do wonder about the issue. It is related to the ssh b/c within the KVM it works fine too :

```
# git archive --prefix linux-4.7.x/ v4.7 | (cd /usr/src/; tar -tf- 1>/dev/null)
```

(nfs mounted the git tree)Last edited by toralf on Mon Jul 25, 2016 8:01 am; edited 1 time in total

----------

## Hu

You are not unpacking a tar archive over ssh.  You are sending a tar archive to the shell running as root@n22kvm, then locally running some commands after that ssh exits.  Unless root@n22kvm uses tar xf - as its shell, that is highly unlikely to do anything good or useful.  You ran (ssh root@n22kvm; cd /usr/src/; sudo tar -tf- 1>/dev/null).  You probably should have run ssh root@n22kvm sudo tar -C /usr/src/ -x -f -.

----------

## toralf

*head smack* this works:

```
$ git archive --prefix linux-4.7.x/ v4.7 | ssh root@n22kvm "cd /usr/src/; tar -tf- 1>/dev/null"
```

----------

