Israel Science and Technology Directory

Linux Permissions

Updated on January 20, 2026.

  1. Changing permissions using numeric octal code:
    1. Example 1: Permission for folders
    2. Example 2: Permission for files
    3. Recursive application of chmod to a series of files/folders
  2. 2. Changing permissions using symbols:

The command commonly used for changing file and folder permissions using Bash within a terminal window is chmod (change mode). In the Linux world, the "mode" of a file is its set of permissions.

Prior to using this command, it is recommended that you switch to the folder where the file or folder is located. This way you can set the instruction to modify the permissions of files/folders without specifying the full path address.

Note: If you use the command for a folder/file that is owned by root, you may receive a "Permission Denied" error. For folders that you are not the owner, you must prefix the commands listed below with sudo.

The command chmod can be used to change permissions in two ways:

Changing permissions using numeric octal code 🡱

The syntax of the command is:

chmod [options] [numeric code] [file/folder]

Example 1: Permission for folders

The recommended permission code for folders in a website is 755. This code provides the following permissions for the three categories of users:

Owner (u) Group (g)Others (o)Final
Stringrwxr-xr-xrwxr-xr-x
Numeric755755

The code to assign these permissions is:
chmod 755 /folder-name

The code 755 provides full permissions (7) to the owner, but only Read (r) and Execute (x) permissions (5) to the anonymous user. The execute permission enables the user to traverse through folders; but without a permission to change (write) anything.

Example 2: Permission for files

The recommended permission code for files in a website is 644. This code provides the following permissions for the three categories of users:

Owner (u) Group (g)Others (o)Final
Stringrw-r--r--rwxr-xr-x
Numeric644644

The code to assign these permissions is:
chmod 644 /file-name

The code 644 provides Read (r) and Write (w) permissions to the owner, but only Read (r) permission to the website guest.

Recursive application of chmod to a series of files/folders 🡱

To change the permission of many files/folders in a directory or across directories, you may wish to use the -R option for recursive change of file/folder permissions.
Example code:
chmod -R 755 /file-name

There is a security risk in wholesale change of permissions using the -R option. For example, in changing the folder permissions with 755, the command may also be applied to folder files, making them "executable."

A cautious approach is to apply chmod to files and folders separately using the following commands specific for folders and files respectively:

To change directory/folder permissions use:
sudo find /path/to/directory -type d -exec chmod 755 {} \;

To change file permissions use:
sudo find /path/to/directory -type f -exec chmod 644 {} \;

2. Changing permissions using symbols:

The syntax of the command is:

chmod [User sym.][+||−||=][Perm. sym.] [file/folder]
Note: || means "or".

This code includes three types of symbols (Sym.) shown in the tables below.

User symbols
Sym.User type
uUser/owner
gGroup
oOthers
aAll
Action symbols
Sym.Action
+Add permission
Remove perm.
=Set perm.
Permission symbols
Sym.Permission
rRead
wWrite
xExecute
XConditional exe.

Example code:
chmod u+x script.sh
This command means "for the user ( u ), add ( + ) execute ( x ) in script.sh".

The previous section included a warning for recursive (-R) use of 755 for changing permissions that could be applied to files in addition to folders. In the present command syntax, the permission symbol capital X limits changing execute bit only if the file is a directory, or the file already has an execute bit set. This option prevents accidental conversion of files to executable files.

Next: Permissions needed for file and folder operations

ADVERTISEMENT