Sample output of "ls -l" :
drwxr-xr-x
6user
users
200 2003-05-02 10:21 Documentsdrwx------
2user
users
112 2003-09-23 08:52 Mail-rw-r--r--
1root
root
0 2003-06-16 15:25 TESTlrwxrwxrwx
1root
root
5 2003-05-27 16:20 bin -> /bin/
All files / directories / other are associated with a user and a group.
Access rights are the first right caracters.
The first character indicates whether a link, directory, or other file.
d | Directory |
l | Link |
- | File |
p | ? Pipe ? |
The last 9 are separated as follows :
USer | Group | Everyone | ||||||
read | write | execute | read | write | execute | read | write | execute |
Number equivalent to the security bits:
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
--- | --x | -w- | -wx | r-- | r-x | rw- | rwx |
Note: You can run a script or program that you have execute permission (x). To run a file in the current directory, type ". / <file>"
There are two ways to define the mask (access rights).
Specify the acces rights with number.
Syntax:
chmod <mode> <file>
eg "chmod 750 file" will produce the following permissions: "rwxr-x ---"
In relative mode we defines what we want to change
Syntax:
chmod <mode> <file>
The mode is defined as follows: <who><change><what>
Who | o | "Other" nor group, nor user |
g | Group | |
u | User | |
Change | + | Add |
- | Remove | |
What | r | Read |
w | Write | |
x | Execute |