Linux Permissions

Every directory and file has an owner and an owning group. Similarly, each has permissions. These permissions are presented in the following manner:

owner - group - others

Permissions can be represented as numbers or as letters. For numbers, the following key is used:

Readable = 1
Writable = 2
Executable = 4

So to make a file rwx for only the owner, you would do
chmod 700 FILE

If you wanted it rwx by the owner and group, but only rx by others, you would do:
chmod 775 FILE


Permissions are also represented by letters. As such, a permission of 777 corresponds to:

rwxrwxrwx

775 would be

rwxrwxr-x

To change permissions in a letter way, you still use chmod, but you have different symbols:

u = owner (user)
g = group
o = others
r = readable
w = writable
x = executable

So to make a file have 777 permissions, you could do:
chmod uog+rwx

Or, since you're doing it to everyone, you could just say:
chmod +rwx FILE

But what if you want to do 775?

chmod ug=rwx
chmod o=rx

The = obviously sets the permissions to EQUAL that. The + adds those permissions, and the - removes those permissions.

...taken from post on Linux Forums: Root Prompt Access

0 comments: