0% found this document useful (0 votes)
26 views1 page

Linux Permission

Uploaded by

House Of Movies
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)
26 views1 page

Linux Permission

Uploaded by

House Of Movies
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/ 1

Linux File Permission

File permission
The creator of a file becomes the owner of the file and the file also belongs to the creator’s group.
The owner can set permission to file. 3 types of permission

FILES DIRECTORIES
read (r) read and copy list its content
write (w) modify rename, create and delete files
execute(x) run/execute to make as working directory (search and use the files)

Usually you need a read permission as well, to execute certain program for example a shell script (since it is a text file).
To fully protect a file, we need to check both files and directory permission.

chown
To change ownership, you must be superuser or owner
$ chown mamat myfile change ownership of myfile to mamat
$ id to ascertain present user id and group id.
$ id –a additional information on all groups to which the user belongs to

To change group ownership, usually you must be superuser


$ chgrp admin myfile change group ownership of myfile to admin

Every UNIX has 3 types of users


 owner
 members of the group
 all other users

$ ls –l myfile
-rwxr-xr-- 2 mamat staff 155 20 Jan 2:15 myfile
In the above example, myfile is owned by mamat with read, write and execute permission. (-rwxr-xr--)
The members of staff group have read and execute permission only. (-rwxr-xr--)
The rest have read permission only. (-rwxr-xr--)

chmod
To change user permission
$ chmod <usertype> <action> <permission> <filename>
 usertype (u =owner, g =group, o =other users, a=everybody)
 action (+ add permission, - remove permission, = makes a permission equal to)
 permission (r=read, w=write, x=execute)

$ chmod go+w myfile to add write permission to group and other members
$ chmod a+wx myfile to give write and execute permission to all users
$ chmod go-rwx mysub remove all group and other users permission to your subdirectories

Permission can also be given using absolute notation

Octal Type of Permission


0 - - -
1 - - x
2 - w -
3 - w x
4 r - -
5 r - x
6 r w -
7 r w x

$ chmod 740 7 gives read, write and execute permission to owner


4 gives read permission to group
0 gives no permission to the rest

umask
umask is opposite of chmod absolute notation table. It denies access. Usually, every users will be issued a default umask for every files created.
$ umask 002 0 users not affected
0 groups not affected
2 write permission for rest of users is invoked.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy