This is a very simple process. Although there are a few other ways of
I am going to show you the most "macho" way. There are three permission
and each one has three types of permissions you can set. Each type of
has a numerical value, and when you add up the values of of the
permissions in each
of your three groups, you get the desirable number.
-rwx-wx--x 1 daniel daniel 0 Jun 19 17:27 test
Lets break down the permissions section at the beginning of that 'll' listing.
- rwx -wx --x
In this case, the first - means it's not a directory. There's more to learn about other potential significances for this, but I don't know them yet.
The next section has three letters (r w x) - Read, Write, Execute. These three are part of the first of the three groups, Owner. Since all three letters are listed, it means that the owner of the file (Daniel) can read, write, and execute the file.
The next section is (- w x). This is the "group" section. This means that everyone in the same group as Daniel is allowed to write and execute the file, but NOT read it.
The last section is (- - x). This is the "world" section. This means that everyone who is neither the owner nor in the owners group is allowed to ONLY execute the file.
Now, to change the permissions on a file, you must type the 'chmod' command, followed by a three digit number, and then the name of the file or directory whos permissions you wish to alter. Lets say we want to make it so file 'test' can ONLY be read, written to, and executed by the owner and no one else. The command to execute would be the following:
chmod 700 test
I figured this out by adding the values of r, w, and x together.
r = 4, w = 2, x = 1
Since we wanted owner (first digit) to be allowed all three, I added 4, 2, and 1 to get the seven. Group and World wasn't allowed to do anything, so they got zero. Here's one more example. This one will give owner read/write, group only write, and world only read:
chmod 724 test
It's a simple task, but I hope some beginners can learn from it.