File Permission
The simplest file permission in Linux are the r (read), w (write), x (executable). These file permission yields for u (user), g (group) and o (other). They can be set both:
- Symbolically: +-r, +-w, +-x
- Numerically: r=4, w=2, x=1
Special Permission
There are three special permission: setuid, setgid and sticky. They can be both applied to files and directories, but then have different meanings.
Special Permission | File | Directory |
setuid | Only meaning for executable file: The executable file be be run as the file owner, not as the user that executes it. Example /usr/bin/passwd |
No effect. |
setgid | Only meaning for executable file: The executable file be be run as the file group, not as the user that executes it. | All newly created file in directory, will inherit the parent directory group permission. |
sticky | No effect. | All files created with a user that have write permission for a specific file can only remove that file, except for root. Example: /tmp |
To set the special permission:
- Symbolically: setuid=u+s, setgid=g+s, sticky=o+t
- Numerically: setuid=4, setgid=2, sticky=1
No comments:
Post a Comment