Pages

Tuesday, December 25, 2012

Shell script Give executable permissions to all users

Q. How to give executable permissions to a shell script for every one in the machine?

When ever user want to execute a shell script he should have execute permissions on that, then only he will execute with out any issue. Most of the people will give permissions to them(for user bit alone) alone when changing permissions. This is right way to do it and it will avoid others not to execute his scripts. But some times its required to give full permissions(executable permissions) to a script if it should run for any user in the script. 

Below is the command to set full permission to a script so that any in that machine can execute the script.

chmod a+x scriptname

or
chmod ugo+x scriptname

or
chmod +x scriptname

Once the permissions are set, any user can execute the script by using below commands.

./scriptname

or
/path/to/scriptname

or
bash scriptname


0 comments:

Post a Comment