0% found this document useful (0 votes)
8 views23 pages

Read (R) Write (W) Execute (X)

The document explains file permissions in a Linux environment, detailing the read, write, and execute permissions for users, groups, and others. It describes how to use the 'chmod' and 'chown' commands to modify file permissions and ownership. Additionally, it provides examples and resources for further reading on file permissions.

Uploaded by

newsuper444
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views23 pages

Read (R) Write (W) Execute (X)

The document explains file permissions in a Linux environment, detailing the read, write, and execute permissions for users, groups, and others. It describes how to use the 'chmod' and 'chown' commands to modify file permissions and ownership. Additionally, it provides examples and resources for further reading on file permissions.

Uploaded by

newsuper444
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Permissions

Read Write Execute


(r) (w) (x)
Permission levels

User Group Other


(u) (g) (o)
Long Listing Fields

- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh


- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

The first character is most often -, l or d.


And other letters are used for other types of special files

d : directory
- : file
l : symbolic link
- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

In general, that field represents the permissions of the user (the owner of the file). [Note: By default, the person who created a file becomes its
owner]

In the above example: scipt.sh is readable, writable and executable by the owner.

r read permission
w write permission
x execute permission
- no permission
- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

In general, that field represents the permissions of the users of the group. [Note: All users belonging to a group will have the same Linux group
permissions access to the file]

In the above example: scipt.sh is readable and executable by the group.

r read permission
w write permission
x execute permission
- no permission
- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

In general, that field represents the permissions of others (everybody else).

In the above example: scipt.sh is readable and executable by others.

r read permission
w write permission
x execute permission
- no permission
- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

This field specifies the number of hard links or directories inside this directory.
- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

That field represents the user that owns the file/directory.

In the above example: scipt.sh is owned by root.


- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

That field represents the group that file belongs to.

Note: Any user in that group will have the permissions given in the third field over that file.

In the above example: scipt.sh is readable and executable by the users in the group root.
- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

The size in bytes.


- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

The date/time the file was last modified.


- rwx r-x r-x 1 root root 22 Jan 1 13:37 script.sh

file/directory name
watch

It is used to execute a program periodically, showing the output on the terminal window.
df

It is used to display information related to file systems about total space and available space.
chmod chown
It is used to modify the It is used to change the
permission types for owner and the group of
files and directories. files and directories.

(change mode) (change owner)


chmod

symbolic numeric
mode mode
chmod

symbolic mode
chmod [u/g/o/a/none] [+/-/=] [permission type] file/directory

[u]: user | [g]: group | [o]: others | [a]: all | [none]: all

[+]: add the permission | [-]: remove the permission | [=]: set the exact permissions

[permission type]: [r],[w],[x],…etc.


chmod

numeric mode
4 2 1
(read) (write) (execute)

Example:
chmod 754 file

User Permissions = 7 = 4+2+1 = rwx

Group Permissions = 5 = 4+0+1 = r-x

Others Permissions = 4 = 4+0+0 = r—

rwx/r-x/r--
chown
To change the owner of a file:

chown USER FILE

-----------------------------------------------------

To change the group of a file:

chown :GROUP FILE

-----------------------------------------------------

To change the owner and group of a file:

chown USER:GROUP FILE


Resources
https://www.guru99.com/file-permissions.html

https://www.garron.me/en/go2linux/ls-file-permissions.html

https://unix.stackexchange.com/questions/103114/what-do-the-fields-in-ls-al-output-mean

https://www.computernetworkingnotes.com/rhce-study-guide/how-to-use-chmod-command-in-linux-explained-with-examples.html

https://askubuntu.com/questions/29589/chmod-ux-versus-chmod-x

https://www.computerhope.com/unix/uchmod.htm

https://wiki.archlinux.org/index.php/File_permissions_and_attributes

https://linuxize.com/post/chmod-command-in-linux/

https://linuxize.com/post/linux-chown-command/
‫هذا ما عندي‬
‫فإن أحسنت فمن هللا‬
‫وإن أسأت أو أخطأت فمن نفسي والشيطان‬
Q&A

You might also like