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'm trying to set up SSH so that I can easily log into an server that is accessible only via a sudo to an intermediate server.

From the command line, logging into it is of the form:

sudo -u admin ssh

This works without problems -- fair enough. However, the following variants do not work in a ProxyCommand:

ProxyCommand sudo -u admin ssh

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

ProxyCommand sudo -u admin ssh -t -t

tcgetattr: Invalid argument

This last variant appears to actually exchange information with the destination server, but then it hangs:

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /home/me/.ssh/config
debug1: Applying options for destination
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Executing proxy command: exec sudo -u admin ssh -t -t
debug1: identity file ...
debug1: identity file ...
debug1: identity file ...
debug1: loaded 3 keys
tcgetattr: Invalid argument
debug1: ssh_exchange_identification: Last login: Fri Jan  4 22:48:26 2013 from

I have the feeling that there is something I'm missing in the sudo / ssh interaction inside a ProxyCommand, but haven't been able to figure it out.

share|improve this question
Won't something like ProxyCommand ssh admin@destination.server.comwork? Why is sudo necessary? – terdon Jan 4 '13 at 23:18
admin is set up with a public/private key pair – brool Jan 4 '13 at 23:31
Couldn't you just encrypt the private key? The passphrase would serve the same purpose as the sudo password. – Dennis Jan 5 '13 at 0:02

Your Answer


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

Browse other questions tagged or ask your own question.