Run a shell script in EC2

It’s really simple to execute a batch file in Windows by just invoking the script in PowerShell or by double-clicking. Similarly, you must specify the shell script in order to invoke it in EC2 instances (Linux/Ubuntu, etc.). However, you’ll need to do a fast “chmod” action in order to execute a script. Otherwise, Ubuntu throws a permission denied error when you try to run a shell script.

[root@ip-xx-x-x-xxx ~]$ ./backupscript.sh
bash: ./backupscript.sh: permission denied
[root@ip-xx-x-x-xxx ~]$ chmod -R 777
[root@ip-xx-x-x-xxx ~]$ ./backupscript.sh

Hope you find this information useful.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s