Setting up permissions on a script

From Linux Shell Scripting Tutorial - A Beginner's handbook
Jump to: navigation, search
← Shell CommentsHomeExecute a script →

The chmod command (change mode) is a shell command in Linux. It can change file system modes of files and directories. The modes include permissions and special modes. Each shell script must have the execute permission. Mode can be either a symbolic representation of changes to make, or an octal number representing the bit pattern for the new mode bits.


Allowing everyone to execute the script, enter:

chmod +x


chmod 0755

Only allow owner to execute the script, enter:

chmod 0700


chmod u=rwx,go=


chmod u+x

To view the permissions, use:

ls -l

Set the permissions for the user and the group to read and execute only (no write permission), enter:

chmod ug=rx

Remove read and execute permission for the group and user, enter:

chmod ug=

More about chmod

Type the following command to read chmod man page:

man chmod

Please note that script must have both executable and read permission.

External links

← Shell CommentsHomeExecute a script →