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?

2
  • what do you have in your ~/.bashrc or equivalent? Post verbose log of the connection ssh -vvv ...
    – Jakuje
    Jan 12, 2016 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. Jan 12, 2016 at 16:43

1 Answer 1

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 ...

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .