chmod

>Usage

chmod is a command used to change the permissions of files and directories. Permissions control who can read, write, or execute a file. chmod allows you to modify these settings to make files more secure or accessible to certain users.

>Synopsis

chmod [option] [option]

>Options

-r

-r (read): Grants the user permission to read the contents of the file.

Example 1:

Dots

-zsh

> chmod u+r file.txt


-w

-w (write): Grants the user permission to modify the contents of the file.

Example 2:

Dots

-zsh

chmod g+w file.txt


-x

-x (execute): Grants the user permission to run the file as a program or script.

Example 3:

Dots

-zsh

> chmod o+x script.sh


-u

-u (user): Refers to the file's owner (the user who created or owns the file).

Example 4:

Dots

-zsh

> chmod u+x file.txt


-g

-g (group): Refers to the group of users who share access to the file. In Unix systems, a file can be assigned to a specific group, and members of that group may have different permissions than others.

Example 5:

Dots

-zsh

> chmod g-w file.txt


-o

-o (others):Refers to all other users who are not the owner or part of the file's group.

Example 6:

Dots

-zsh

> chmod o+r file.txt


-a

-a (all): Refers to all users, including the owner, group, and others.

Example 7:

Dots

-zsh

> chmod a-w file.txt


-+

-+ (add permission): Adds the specified permission to the file.

Example 8:

Dots

-zsh

> chmod +x file.txt


--

- (remove permission):Description: Removes the specified permission from the file.

Example 9:

Dots

-zsh

> chmod -x file.txt


-=

-= (set permission): Sets the file's permission explicitly, removing any other permissions that aren't listed.

Example 10:

Dots

-zsh

> chmod u=r file.txt


>Quiz

Progress: Question ? out of ?

Question Title

Page written by FIlippo Orlando