Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown    


Changing the permissions can be done with names and numbers, I like the numbers:
( do you remember the chmod 755 command from a few posts ago ? )

# chmod 754  tessst.txt

( Will put the file tessst.txt to rwx r-x r-- )

Here is why:
4=read 2=write 1=execute.
The three numbers in the chmod above are for the "user" ( the first number ), "group" ( the second number ) and "others" ( the third number )

So if I want to give the user all permissions: 4+2+1=7
and i give the group read an execute permissions: 4+1=5
and all others only read permission 4=4

Chown and chgrp are two commands also related to permissions:

# chown

( Changes the owner of the file. )

# chown anna tessst.txt

( Changes the owner of the file tessst.txt from bruno to anna )

# chgrp

( Changes the group the file belongs to - if you did change the user and the user belongs to another group )

# chown -R anna:anna docs

( Changes the user and group ownership of the "docs" directory and all the files in it because of the -R argument ).

Well, this will give you enough exercise for this sunday, tomorrow we will go into hardlinks and symlinks, another little brain-teaser.


NOTE: Next to the method described above there is a second way to change permissions:

chmod takes either the decimal representation of the permissions or a symbolic representation. The symbolic representation is [ugoa][+-][rwx]. This is one of the letters u (user=file owner), g (group), o(others), a(all=u and g and o) followed by + or - to add or remove permissions and then the symbolic representation of the permissions in the form of r(read) w(write) x(execute). To make the file "file.txt" writable for all you type: "chmod a+w  file.txt"

-- May 4 2003 ( Revised Dec 10 2005 ) --

Tips Linux Explorers   All Things Linux Forum   Great Linux Links   Hometown