![]() ![]() If we wanted to add the execute permission for owner, group and other, we could go about it in two ways. Let’s start with the permissions we talked about above, namely: -rw-rw-rw. The best way to explain the command is to go through an example. The easiest utility to use for this purpose is the chmod command. Now that we understand how to read permissions, let’s talk about how we can change them. Hopefully, that’s a good explanation for how to represent permissions in Linux using octal numbers. Five can only be gotten by adding 4 + 1, meaning the group and other users have read and execute permissions. The first number is 7, which we can only get by adding 4 + 2 + 1, meaning the owner has read/write/execute permission. Say we want to know what permissions 755 represents? Well, it’s pretty easy to figure out if you break it down by individual numbers. The second one will be the same as will the third octal number. The first octal number will be 4 + 2 since we are adding read and write. Let’s take a look at the example where we only gave read/write permissions: -rw-rw-rw. We do the same thing for group and the same thing for other. The owner has rwx, so we will add 4 + 2 + 1 to get a value of 7. For example, let’s take the example above where everyone has all permissions: -rwxrwxrwx All you have to do is add them up to get the octal permission. ![]() The read permission is represented by 4, write by 2 and execute by 1. So how does Linux represent read, write and execute using octal numbers? Basically, it just assigns a number to each permission as shown below. When we use the chmod command later on, you’ll see that you can change the permissions using either symbols or octal numbers. The second way to represent the same permissions is by using octal numbers. So that’s how permissions are displayed in Linux using symbols. The owner has read/write/execute permissions, but the group and other users only have read permission. Looking at the first bit, we can see that the permissions are for a directory. This means that everyone only has read/write permissions for the file. If you look at the output from the ls -l command, you’ll notice that my practice text file has the following permissions: -rw-rw-rw. In the example above, the owner, group and everyone else has read write and execute permissions. If you see a dash in place of a letter, it means that the owner, group or all other users do not have that permission. The first three bits are for the owner, the second three bits are for the group and the third three bits are for other. The first bit in each group is for read, the second bit is for write and the third bit is for execute. Next, there are three groups of three bits. Note that the first bit can also be an l if the file name is a link. Dash means it’s a file and d stands for directory. The permissions are written as follows: the first bit is either a dash or the letter d. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |