Permissions and User Groups

File permission in linux is very important on any file system. We need to grant the necessary permissions to files/folders as well as to specific users. A file/folder to be able to read by an application should have the necessary read permissions. Whereas, a file that has to be written into needs to have the write permission. Hence the permissions have to be set for each file or folder. The below command enables the user to change the file permissions:

Command:

The chmod command is used to change the file permission. The command means “change mode”. The -r flag added to it denotes that the permission will be changed for all files within that directory.

chmod

Below are the types of permission:

PERMISSIONDENOTATIONVALUERIGHTS
READr4View Access
WRITEw2Write Access
EXECUTEx1Run Access
NILL0No Access

Below are the types of users:

USERROLE
OWNERThe person who created the file
GROUPA user-group that has similar access
WORLDAny user who is not an owner or part of a group

Permission Modes:

For any file or folder, the permission is set for the 3 user roles Owner, Group and World. A permission of 755 is shown below:

   7                                  5                                5

OWNER                              GROUP                                WORLD

r+w+x                                  r-x                                        r-x

4+2+1                                  4+1                                      4+1

Sample Permission Modes:

VALUEPERMISSION
777rwx rwx rwx
755rwx r-x r-x
744rwx r– r–
655rw- r-x r-x
644rw- r—r–

A 777 permission, denotes a full permission. Which is not normally set as it makes the file full accessible for read, write and execution and thereby vulnerable to attack. Hence, always thick twice before setting a 777 permission. 755 is the normal value set for directories and files should. Executable scripts within the cgi-bin folder must be 755. Images, media, and text files like HTML should be 644.

Changing the File Permission in Linux

Suppose you want to change a file permission on linux from 777 to 755

Method 1: Using Command Prompt:

1. Execute the below command to check the file permission. It lists all files in the directory including their permission:

ls -l

2. Run the chmod command to change the permission to 755

chmod 755 file_name

Replace filename with the original filename

Method 2: Using cPanel:

1. Login to your cPanel

2. Click ‘File Manager’

Files Permission on Linux

3. Access the file you want the permission changed.

4. Change permission by either of the below 3 methods:

a. Permission option on top

Files Permission on Linux

b. Double clicking the permission corresponding to the file

Files Permission on Linux

c. Right mouse the file name and select Change Permission from Options

Files Permission on Linux

5. Set the permission to 755

Conclusion

Following the above steps helps admin to change the file permission in Linux for any file/directory.

If you want all your KPI‘s or Business metrics monitored on a single dashboard, join our BETA.

By Liz Mathew

Founder, InsightDials

error: Content is protected !!