CONTENT
  • CHANGES
Szukaj
counter

#top chmod


chmod - change file access permissions

Powiązane:

SYNOPSIS
chmod [OPTION]... MODE[,MODE]... FILE...
chmod [OPTION]... OCTAL-MODE FILE...
chmod [OPTION]... --reference=RFILE FILE...


DESCRIPTION
The format of a symbolic mode is '[ugoa...][[+-=][rwxXstugo...]...][,...]'. Multiple symbolic operations can be given, separated by commas.

A combination of the letters 'ugoa' controls which users' access to the file will be changed: the user who owns it (u), other users in the file's group (g), other users not in the file's group (o), or all users (a). If none of these are given, the effect is as if 'a' were given, but bits that are set in the umask are not affected.

The operator '+' causes the permissions selected to be added to the existing permissions of each file; '-' causes them to be removed; and '=' causes them to be the only permissions that the file has.

The letters 'rwxXstugo' select the new permissions for the affected users: read (r), write (w), execute (or access for directories) (x), execute only if the file is a directory or already has execute permission for some user (X), set user or group ID on execution (s), sticky (t), the permissions granted to the user who owns the file (u), the permissions granted to other users who are members of the file's group (g), and the permissions granted to users that are in neither of the two preceding categories (o).

A numeric mode is from one to four octal digits (0-7), derived by adding up the bits with values 4, 2, and 1. Any omitted digits are assumed to be leading zeros. The first digit selects the set user ID (4) and set group ID (2) and sticky (1) attributes. The second digit selects permissions for the user who owns the file: read (4), write (2), and execute (1); the third selects permissions for other users in the file's group, with the same values; and the fourth for other users not in the file's group, with the same values.


OPTIONS
-c, --changes
like verbose but report only when a change is made

--no-preserve-root
do not treat '/' specially (the default)

--preserve-root
fail to operate recursively on '/'

-f, --silent, --quiet
suppress most error messages

-v, --verbose
output a diagnostic for every file processed

--reference=RFILE
use RFILE's mode instead of MODE values

-R, --recursive
change files and directories recursively

--help
help display this help and exit

--version
output version information and exit

Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+'.

NOTE
chmod: change permissions for:
u - user
g - group
o - others
a - all users

chmod: set (add) permissions
+r - read
+w - write
+x - execute
+s - user or group ID
+t - sticky bit
+X - execute only for directories

chmod: remove (sub) permissions
-r - read
-w - write
-x - execute
-s - user or group ID
-t - sticky bit
-X - execute only for directories



EXAMPLES
remove execute perm on files, set execute for directories
(needed because: "chmod a-x /path/to/dir" causes: chmod: '/path/to/dir': Permission denied)
chmod -R u+r-x+X /path/to/dir

Modyfikacja uprawnień (dodanie, usuwanie) dla użytkownika:
chmod u+r /path/to/file
chmod u+w /path/to/file
chmod u+x /path/to/file
chmod u+s /path/to/file
chmod u-r /path/to/file
chmod u-w /path/to/file
chmod u-x /path/to/file
chmod u-s /path/to/file
chmod u+rw /path/to/file
chmod u+rwx /path/to/file
chmod u-rw /path/to/file
chmod u-rwx /path/to/file
chmod u+r-w /path/to/file
chmod u-r+x /path/to/file

Modyfikacja uprawnień (dodanie, usuwanie) dla użytkowników należących do grupy właściciela pliku:
chmod g+r /path/to/file
chmod g+w /path/to/file
chmod g+x /path/to/file
chmod g+s /path/to/file
chmod g-r /path/to/file
chmod g-w /path/to/file
chmod g-x /path/to/file
chmod g-s /path/to/file
chmod g+rw /path/to/file
chmod g+rwx /path/to/file
chmod g-rw /path/to/file
chmod g-rwx /path/to/file
chmod g+r-w /path/to/file
chmod g-r+x /path/to/file

Modyfikacja uprawnień (dodanie, usuwanie) dla pozostałych użytkowników:
chmod o+r /path/to/file
chmod o+w /path/to/file
chmod o+x /path/to/file
chmod o+s /path/to/file
chmod o-r /path/to/file
chmod o-w /path/to/file
chmod o-x /path/to/file
chmod o-s /path/to/file
chmod o+rw /path/to/file
chmod o+rwx /path/to/file
chmod o-rw /path/to/file
chmod o-rwx /path/to/file
chmod o+r-w /path/to/file
chmod o-r+x /path/to/file

Modyfikacja uprawnień (dodanie, usuwanie) dla wszystkich:
chmod a+r /path/to/file
chmod a+w /path/to/file
chmod a+x /path/to/file
chmod a+s /path/to/file
chmod a-r /path/to/file
chmod a-w /path/to/file
chmod a-x /path/to/file
chmod a-s /path/to/file
chmod a+rw /path/to/file
chmod a+rwx /path/to/file
chmod a-rw /path/to/file
chmod a-rwx /path/to/file
chmod a+r-w /path/to/file
chmod a-r+x /path/to/file





Zmodyfikowany ostatnio: 2014/05/09 14:55:01 (9 lat temu), textsize: 5,72 kB, htmlsize: 8,02 kB

Zapraszam do komentowania, zgłaszania sugestii, propozycji, własnych przykładów, ...
Dodaj komentarzKomentarze użytkowników