How to Change File Permissions on Linux

Ability to line file permissions for individual users or user-groups is one among the foremost asked for options of UNIX. If you're system admin for a faculty, school or a corporation you're employed for then correct file permission setting is among the foremost very important tasks.
The command accustomed modify file permissions is chmod, short for modification mode of a file. you'll conjointly use Nautilus file browser to alter the file permissions. i'll cowl the main points once slightly background on the file permissions. to search out the permission settings for a file, issue the subsequent command int he terminal from the directory wherever your file is.
ls -l 
cmd output
As you'll see, the primary column within the output has some strange wanting character sets. This set is that the file permissions for that file (directory). The third column is that the owner of the file (directory) and therefore the fourth column is that the default cluster of the file (directory). we are able to ignore all the opposite columns at now.
In the 1st column, every set would be ten character wide. The terribly 1st character may be a d for a directory or simply a - (hyphen) for files. After that, successive 3 characters area unit the permissions for the homeowners account. The order is read-write-execute. If the superuser will scan the file it might show r otherwise simply a -. equally for write and execute w and x would be displayed. successive 3 characters area unit permissions for all the opposite users happiness to the file cluster (from the fourth column within the output above). Final 3 characters area unit the permissions for everybody not a part of the cluster. Superusers (root accounts) will forever override all the settings mentioned here and none of the permissions apply to them.
Changing Permissions – the simple method
The easiest method, as I said, is to merely modification the file permissions mistreatment Nautilus however it’s time intense if you would like to alter the permissions of plenty of files. instruction method could seem tedious to start with however it’s the quicker method once you recognize your method around. to alter the permissions in Nautilus, right click on any file (directory). head to properties and so to permissions. modification the permissions and click on ok. That’s it.

Changing Permissions – The quicker method
To change file permissions via the terminal, you'll use the chmod command. to alter permissions of a file, enter the subsequent command within the terminal.
chmod alphabet path/to/file
Here, alphabet may be a three digit variety that is that the decimal illustration of the file permissions. as an example, r-x means that a hundred and one in binary that interprets to five in decimal. So, if you would like everybody to possess simply scan and execute access to files and solely the owner has the write access to files then the permissions area unit rwx,r-x,r-x that is 111,101,101. That interprets to seven,5,5 (comma is barely given for clarity here). So, the command would currently be,
chmod 755 path/to/file
Don’t worry if you don’t shrewdness binary works, you may get accustomed it. simplest way is add four for scan, a pair of for write and one for execute. So, considering the examples higher than, rwx = four + a pair of + one = seven and r-x = four + zero + one = five. You’ll get accustomed this. there's in a different way to to the present, the text methodology (which I don’t prefer).
chmod who=permissions file name
Where World Health Organization is any from a variety of letters, and every signifies World Health Organization you're attending to provide the permission to. they're as follows:
u - The user that own the file.
g - The cluster the file belongs to.
o - the opposite users i.e. everybody else.
a - all of the higher than - use this rather than having to sort ugo.
And then you'll directly write rwx before of the equal sign. as an example,
chmod g=rx