OK, enough people have asked me about Linux file permissions so I figured I'd write a short tutorial on how they work. It is *very* simple. Here we go...
Type this command at the console anyplace in the directory tree
#[Crack-Monsta@Localhost Acid]ls -ld
This will return something like this:
drwxr-xr-x 19 root root 4096 Nov 20 09:05
The first letter indicates a directory and tells you that the owner has Read Write and eXecute rights. Now, lets take this apart to see how this works:
If we break this up, from left to right you get this:
d rwx r-x r-x
directory Owner perms Group perms Everyone else perms
The "-" indicates that the right is turned off. So, we can say that the owner has full rights while the group and everyone else has read and execute only because the "-" tells us that the write permission is turned off.
CHANGING PERMISSIONS WITH CHMOD
================================
For some reason people are afraid of this command. You'll see someone do a chmod 777 on a file and you wonder to yourself, "What the hell is that all about?". It's easy. Each permission is assigned a value as follows
r (read) = 4
w (write) = 2
x (execute) = 1
So in chmod 777 you are giving full rights to the owner, the group and everyone else. Still confused? Look at this table below
chmod 777 files -- rwxrwxrwx
chmod 755 files -- rwxr-xr-x
chmod 644 files -- rw-r--r--
chmod 000 files -- ---------
So it is all just a matter of simple math to assign or revoke perms. That's it. Now, isn't that simple?![]()




Reply With Quote