1

I'm trying to execute a simple ssh remote command from my local machine to an AWS instance, by running:

ssh -i /my/key.pem ec2-user@<myhost> 'ls -l'

When I do this, the command returns with exit code 255 and it leaves a process hanging on the ec2 instance sshd: ec2-user [priv]

If I run it with a tty

ssh -t -i /my/key.pem ec2-user@<myhost> 'ls -l'

It works. Even though 'ls -l doesn't require user input, why does it still require a tty, and why does it leave that process hanging?

  • what do you have in your ~/.bashrc or equivalent? Post verbose log of the connection ssh -vvv ... – Jakuje Jan 12 '16 at 8:45
  • no output on -vvv but i realized this is only happening when I'm on a VPN. not on VPN it works fine. not sure why that would happen. – Jeff Storey Jan 12 '16 at 16:43
0

Normally this happens in cases of X11 window forwarding - not sure why that would happen with ls, but setting DISPLAY has helped me in the past:

DISPLAY=:0 ssh -i ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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