Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have an instance at AWS which contains an application deployment script in my home folder. The script contains sudo commands. I need to run this script automatically from a program at my local machine. I try to execute ssh -i key.pem -t ec2-user@dns.compute.amazonaws.com '~/script.sh' but get permission denied error. What can be the cause for it? The path to the file is correct, it is owned by me and has correct permissions.

share|improve this question
try 'strace ~/script.sh' –  Andrew Smith Oct 31 '12 at 12:54
Is this SSH denying permission to log on to the EC2 instance or some part of the script denying permission to do whatever it's doing? Try to narrow down the possibilities until you get the exact line that's causing the error. –  Ladadadada Oct 31 '12 at 13:01
check /var/log/secure for any errors that might tell you why it is failing. –  Jason Floyd Nov 1 '12 at 6:09

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.