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 without 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 it's 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
The following two tabs change content below.
Mr Surendra Anne is from Vijayawada, Andhra Pradesh, India. He is a Linux/Open source supporter who believes in Hard work, A down to earth person, Likes to share knowledge with others, Loves dogs, Likes photography. He works as Devops Engineer with Taggle systems, an IOT automatic water metering company, Sydney . You can contact him at surendra (@) linuxnix dot com.
Latest posts by Surendra Anne (see all)
- Docker: How to copy files to/from docker container - June 30, 2020
- Anisble: ERROR! unexpected parameter type in action:
Fix - June 29, 2020 - FREE: JOIN OUR DEVOPS TELEGRAM GROUPS - August 2, 2019
- Review: Whizlabs Practice Tests for AWS Certified Solutions Architect Professional (CSAP) - August 27, 2018
- How to use ohai/chef-shell to get node attributes - July 19, 2018