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?

Jeff Storey
  • 448
  • 1
  • 7
  • 19
  • what do you have in your `~/.bashrc` or equivalent? Post verbose log of the connection `ssh -vvv ...` – Jakuje Jan 12 '16 at 08: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

1 Answers1

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 ...
Sooth
  • 161
  • 1
  • 5