SSH into your instance and run sudo visudo
. Find this line: Defaults requiretty
and add this line below it: Defaults:ec2-user !requiretty
Save and exit. (If you're not familiar with vi
, press i
to go into insert mode to make changes to the file. Then press ESC
when done and ZZ
to save and exit.)
And then run the SSH command with the addition of the -t
switch:
ssh -t -i FILENAME.pem ec2-user@ec2-00-000-00-00.eu-west-1.compute.amazonaws.com su --session-command="./update.sh"