TheTAZZone - Internet Chaos

Tutorial – Setting Permissions in Linux

ORIGINALLY POSTED BY NOKIA FOR THETAZZONE/TAZFORUM HERE

Do not use, republish, in whole or in part, without the consent of the Author. TheTAZZone policy is that Authors retain the rights to the work they submit and/or post…we do not sell, publish, transmit, or have the right to give permission for such…TheTAZZone merely retains the right to use, retain, and publish submitted work within it’s Network

Code: Select all
This paper is the work of The Master Jedi Pimpsor AKA thehorse13, who has kindly consented to it being hosted here on the TAZ.

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?

Leave a Reply

Your email address will not be published. Required fields are marked *

Advertise

If you'd like to advertise on The Mutt ( aka TheTAZZone.com ) feel free to contact us at: administration[at]thetazzone.com

TheTAZZone is a non-commercial entity. We do not sell any products or services ourselves. Our revenue comes from advertising and donations only.

We appreciate your support! Your advertising revenue ( or donations ) helps us to continue to upgrade, improve, and offset the costs of maintaining this site.

Donations can be made through the page ' Donate '.