 In this demo, I'm going to talk about how the basics of permissions work in the Linux operating system. So that is who gets permission to read, write and execute files and directories. In this demo, I'm initially logged in as my normal user, S Gordon. So we see in the command prompt, it shows us the name of the user that's currently logged in and executing the shell. In this case, S Gordon. The prompt also shows us the name of the computer, in this case, Netlab01 for this demo. And then it shows the current working directory we're in, which is our home directory, which is given by the Tilda character there. So I've set up this computer to have multiple users running on the system. So we'll look at how different users can access other users' files and directories. And how the different permissions impact upon the access. LS, of course, lists the set of files in our directory. But to see some more information, we use LS minus L to give a long output. Without going through all the details of the output, if we look at the first line here, we see there are a number of columns. The first column of these 10 characters to do with the permissions of that file or directory. So we're going to explain what they mean, those D, R, W and X. The other thing that's important, of course, to the rightmost column, we have the file or directory name. And each file has an owner in terms of the user and an owner group. So this column here, the third column shows the owner of that file or directory, the user that's the owner. In this case, S Gordon is the owner, me. The next column shows the group owner. So we have two different levels so far. We have users and groups where users can be part of groups. In fact, can be part of one primary group and multiple other groups. So a user can be part of many groups in the system. How to set up the users and the groups and the membership of groups is another topic. We won't go through that in this demo. So from the first line, we see that there's this file or directory CSS322, owned by the user S Gordon, and by the group CSS322. And we see in this set of files and directories, there are eight of them in this current directory, all owned by the user S Gordon, me, but they are owned by different groups. CSS322, faculty, and ITS413. I've set up these files just for this demo to illustrate some different capabilities we have, depending upon the permissions. The thing we want to look at is this first column and what all those different characters mean. And I've summarized that in the permissions file here. There are 10 characters there. The first character indicates whether this is a file or a directory. If the D is there, then it's a directory. And if there's no D there, that is the directory option is not set, you see a dash, then it means it's a file. So we can see in this set of eight files, there are four directories and four files. In the terminal here, it gives us some color coded output as well. We see the blue ones are the directories. So the directories are color coded blue in this case. But in some cases, you will not see that color coding. So looking at the first character in the permissions, you know whether it's a file or a directory. The next nine characters indicate the permissions that a user, a group and other set of users have on that file or directory. So we can see there's nine characters and they're separated into groups of three. So the next three characters, RWX, are about the permissions for the owner of that file, the user. So the user for the, in fact it's, the directory CSS322 is S Gordon, as given by the column here. And these three letters, RWX, indicate the permissions that S Gordon has on that directory. The R means it's readable, W means writable, and X executable. In terms of a directory, you can think of executable as being that you can enter that directory. Readable means you can see the contents of that directory. And writable means that you can modify the contents of that directory. For example, create and delete files in that directory. So in this example, I'm the user S Gordon and I can look at the files in the directory CSS322. I can, I have write permission so I can edit and create files in that directory. And I can enter that directory because I have execute permissions. That's for the user, the owner of that directory. The next three characters indicate the permissions for the users that are within the group owner. That is we know that the directory CSS322 is owned by the group also called CSS322. It doesn't have to be the same name there, it just is in this example. We'll see some different ones later. Anyone within that group has the permissions indicated by these three characters, R-X. Again, the characters mean the same as before, readable, writable, or executable. In this example, anyone within the CSS322 group can read the directory. They cannot write to the directory because we see that the middle character there is a dash. That is the W is not present, so they don't have write permissions. And then the next character, the X, the users in the CSS322 group can execute on the directory CSS322. The final set of three characters indicate the permissions for other users. That is users on the system that are not part of the group and are not the owner. So that users that are on the system that are not S Gordon and that are not within the group CSS322. In this example we see that those other users have no permissions on that directory. They cannot read, write, or execute the directory. And that's the same for all the other files in this directory. If we take the next line, the example.txt file, we know it's a file because the first character is not set to D. It's a dash. It's either a file or a directory. The next three characters, R-W-dash, means that the user S Gordon can read and write that file. They cannot execute the file. Executing a directory means you can enter in that directory. Executing a file means, as you expect, you can run that file if it's an executable program. The next three characters, R-dash, indicate the permissions for the users within the faculty group. So we see the group owner in this case is faculty. So anyone within that group can read the file, but as opposed to the S Gordon user, they cannot write that file. Writing the file means editing the file and deleting the file. And then other users, users on the system that are not S Gordon and that are not within the faculty group, also have read permissions on that file. They don't have write or execute permissions. So in summary, we can distinguish between a file or a directory using the first character here. The D indicates that this is a directory. The dash, that is the D directory option, is not set, indicates it's a file. Then we classify into the user, the group and other users, where each set has three different levels of permissions, read, write or execute. So the characters highlighted indicate the user permissions, where the user is given in the third column of the output of LS minus L. The next three characters indicate the group permission, which indicate for all the users within the group indicated by the fourth column in the output, CSS322 as an example, have the permissions indicated by these three characters. And then the other users, the users that are not the owner and are not within the group, have the permissions indicated by the last three characters. In this example, they have no permissions. In the next demo, we'll give some examples where different users view and try to execute, read and write to different files.