Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to copy a file from a computer I can only access via SSHing into an intermediate computer.

Home -> ->

I'm trying to copy from to home. I can ssh from home but not to home. The connection>

has an RSA public key but server will not allow

Home -> server RSA public key.

I've tried

home$ ssh -L 2000:final:22 -N

which gave

channel 2: open failed: administratively prohibited: open failed

I've also tried

ssh -fN -L


ssh -L 2000:final:22 -N

which resulted in.

channel 2: open failed: administratively prohibited: open failed
ssh_exchange_identification: Connection closed by remote host

I got these ideas from scp files via intermediate host and Must I sftp to an intermediate server?

but can't seem to get the results to work, some of the other examples in the first link I can't follow so have only tried the ones I can. I never seem to be able to get ssh to do what I want.

Any help would be appreciated.

share|improve this question
up vote 5 down vote accepted

The SSH server on is configured to refuse all TCP forwarding attempts through it; using -L will not work.

An alternative to SFTP and SCP is good old tar:

ssh "ssh \"cd mydir && tar cz myfile\"" | tar xvz

Or cat:

ssh "ssh \"cat mydir/myfile\"" | pv > myfile

The "| pv" part is optional; it causes a nice progress bar to be displayed if you have the pv program installed.

share|improve this answer
Thanks, all.txt is a test file, the file I ultimately want to copy is a large (5 gig) tar.bzip file dose that matter that its already tared up? – Tommy Sep 15 '11 at 21:11
@Tommy: For a single file? See update. Or just remove the z option from both ends. – grawity Sep 15 '11 at 21:22

It worked for me by adding a "-t" option: ssh -t "ssh \"cat mydir/myfile\""

Since I have a .pem key i use to connect to, and a password to connect to, i had to insert another -i before the -t to point to the .pem file.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.