Permission Information

When you do an ls -l in a directory you may see something like the following:

-rwxr-xr-x 4 root users

These can be narrowed down to:

-rwxr-xr-x = permissions
4 = links to file
root = owner ID
users = group ID

To change permissions you use the command chmod followed by either symbolic or numeric characters that control the permissions. The symbolic representation works as follows:

chmod symbolic modes
Which user?
u user/owner
g group
o others
a all
Action performed
- remove this permission
+ add this permission
= set exactly this permission
Permissions
r read access
w write access
x execute access
s set user/group ID(+,-)
t set the "sticky bit"

Example:
chmod a+r myfile
Gives all users read access to the file myfile.

chmod numeric modes
0 000 ---
1 001 --x
2 010 -w-
3 011 -wx
4 100 r--
5 101 r-x
6 110 rw-
7 111 rwx

Example:
chmod 711 myfile
Gives all pemissions to the owner, execute only for group and other

To Change the owner simply use chown and to change the group just use chgrp. Simple!

Back to Menu

Copyright 2002
Novospace.com