7/6/2018 - 1:54 PM

Uso do chmod

    The format of a symbolic mode is a combination of the letters +-= rwxXstugoa
    Multiple symbolic operations can be given, separated by commas.
    The full syntax is [ugoa...][[+-=][rwxXstugo...]...][,...] but this is explained below.

    A combination of the letters ugoa controls which users' access to the file will be changed:
    User 	letter
    The user who owns it 	u
    Other users in the file's Group 	g
    Other users not in the file's group 	o
    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.

    All users a is effectively user + group + others

    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:

    Permission 	letter
    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
    Restricted deletion flag or sticky bit 	t
    The permissions that the User who owns the file currently has for it 	u
    The permissions that other users in the file's Group have for it 	g
    Permissions that Other users not in the file's group have for it 	o

    Deny execute permission to everyone:
    chmod a-x file

    Allow read permission to everyone:
    chmod a+r file

    Make a file readable and writable by the group and others:
    chmod go+rw file

    Make a shell script executable by the user/owner
    $ chmod u+x myscript.sh

    Allow everyone to read, write, and execute the file and turn on the set group-ID:
    chmod =rwx,g+s file