Changing File Access Permissions in Linux YASH PAL, 3 June 202328 May 2024 Changing File Access Permissions – The Linux file access permission scheme lets you give other users access to the files you want to share yet keep your private files confidential. You can allow other users to read from and write to a file (handy if you are one of several people working on a joint you are proposing). Or you can allow others only to write to a file (similar to an inbox project). You can allow others only to read from a file (perhaps a project specification or mailbox, where you want others to be able to send you mail but do not want them to read your mail). Similarly, you can protect entire directories from being scanned. The owner of a file controls which users have permission to access the file and how those users can access it. When you own a file, you can use the chmod (change mode) utility to change access permissions for that file. The chmod command is used to change the permissions of a file or directory. To use it, you specify the desired permission settings and the file or files that you wish to modify There are two ways to specify the permissions, but I am only going to teach one way It is easy to think of the permission settings as a series of bits (which is how the computer thinks about them). Here’s how it works: rwxrwxrwx = 111 111 111rw – rw – rw = 110 110 110rwx — — = 111 000 000and so on.rwx = 111 in binary = 7rw- = 110 in binary = 6r-x = 101 in binary = 5r– = 100 in binary = 4 Now, if you represent each of the three sets of permissions (owner, group, and other) as a single digit, you have a pretty convenient way of expressing the possible permissions settings. For example, if we wanted to set some_file to have read and write permission for the owner, but wanted to keep the file private from others, we would: [me@Linuxbox me]$ chmod 600 some file Here is a table of numbers that covers all the common settings. The ones beginning with files. 7″are used with programs (since they enable execution) and the rest are for other kinds of files. ValueMeaning777(rwxrwxrwx) No restrictions on permissions. anybody may do anything. Generally not a desirable setting.755(rwxr-xr-x) The file’s owner may read, write and execute the file. All others may read and execute the file. This setting is common for programs that are used by all users.700(rwx——) The file’s owner may read, write, and execute the file. Nobody else has any rights. This setting is useful for programs that only the owner may use and must be kept private from others.666(rw-rw-rw-) All users may read and write the file.644(rw-r–r–) The owner may read and write a file, while all others may only read the file. A common setting for data files that everybody may read, but only the owner may change.600(rw——-) The owner may read and write a file. All others have no right. A common setting for data files that the owner wants to keep private. Computer Science Tutorials Linux computer scienceLinux