Quantcast
Channel: Magnus K Karlsson
Viewing all articles
Browse latest Browse all 526

Linux File and Special Permission

$
0
0

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 PermissionFileDirectory
setuidOnly 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.
setgidOnly 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.
stickyNo 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

Viewing all articles
Browse latest Browse all 526

Trending Articles