1. Basic Permissions:
r
): Allows viewing the content of a file or listing the contents of a directory.
cat file
displays content.ls directory
lists files.w
): Allows modifying the content of a file or adding/removing files in a directory.
echo "text" > file
writes to the file.touch newfile
adds a new file.x
): Allows running a file as a program or accessing a directory.
./script.sh
executes a script.cd directory
changes into the directory.Permission Representation:
-rwxr-xr--
rwx
: Owner permissionsr-x
: Group permissionsr--
: Others permissionsNumeric Mode:
755
represents rwxr-xr-x
.1. Setuid (s
):
chmod u+s file
-rwsr-xr-x
(Setuid bit set)2. Setgid (s
):
chmod g+s directory
-rwxr-sr-x
(Setgid bit set)3. Sticky Bit (t
):
chmod +t directory
drwxrwxrwt
(Sticky bit set)These commands control who can read, write, or execute files and directories, and set special access rules.
Go back to topics page [[Linux Basics]].