SlideShare a Scribd company logo
Dr. D. P.
Mishra
Digitally signed by Dr. D. P.
Mishra
DN: cn=Dr. D. P. Mishra, o=durg,
ou=BIT,
email=dpmishra@bitdurg.ac.in,
c=IN
Date: 2023.03.20 13:20:44 +05'30'
File access permission
• In Unix-like operating systems such as Linux, file access permissions
are used to determine who can access a file and what actions they can
perform on it.
• There are three types of access permissions:
• read (r),
• write (w), and
• execute (x).
• These permissions can be set for three groups of users:
• the file owner,
• the group owner, and
• others.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
FAP
• The access permissions for a file can be viewed using the ls -l
command,
• It displays the file permissions as a string of ten characters.
• The first character indicates the type of file (e.g., "-" for a regular file,
"d" for a directory),
• and the next three characters indicate the owner's permissions,
• the following three indicate the group's permissions, and the
• final three indicate the permissions for others.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Let’s see file permissions in Linux with examples:
Type ls – l on terminal gives
$ ls - l
Here, we have highlighted ‘-rw-rw-r–‘and this is permissions given to the owner, user group and the world.
Here, the first ‘–‘ implies that we have selected a file
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
if it is a directory, d would have been shown.
The characters are pretty easy to remember.
• r = read permission
• w = write permission
• x = execute permission
• – = no permission
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
The first part of the code is ‘rw-‘.
This suggests that the owner ‘Home’ can:
• Read the file
• Write or edit the file
• He cannot execute the file since the execute bit is set to ‘-‘.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
The second part is ‘rw-‘.
It for the user group ‘Home’ and group-members can:
• Read the file
• Write or edit the file
The third part is for the world which means any user.
It says ‘r–‘. This means the user can only:
• Read the file
Changing FAP with chmod
• Say you do not want your colleague to see your personal images.
• This can be achieved by changing file permissions.
• We can use the ‘chmod’ command which stands for ‘change mode’.
• Using the command, we can set permissions (read, write, execute) on
a file/directory for the owner, group and the world.
Syntax: chmod permissions filename
There are 2 ways to use the command
1. Absolute mode
2. Symbolic mode
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Absolute(Numeric) Mode in Linux
• In this mode, file permissions
are not represented as
characters but a three-digit octal
number.
• The table below gives numbers
for all for permissions types.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Number Permission Type Symbol
0 No Permission —
1 Execute –x
2 Write -w-
3 Execute + Write -wx
4 Read r–
5 Read + Execute r-x
6 Read +Write rw-
7
Read + Write
+Execute
rwx
Permission in numeric mode
• The above way of changing permissions will work fine but you may
also need to know how to change permissions in numeric mode.
• chmod is used in much the same way
• instead of r, w, or x you will use numbers.
• What are the numbers?
• 0 = No Permission
• 1 = Execute
• 2 = Write
• 4 = Read
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
The various owners are represented as –
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
User Denotations
u user/owner
g group
o other
a all
Permissions in binary
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Octal Table
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
binary octal permissions
000 0 ---
001 1 --x
010 2 -w-
011 3 -wx
100 4 r--
101 5 r-x
110 6 rw-
111 7 rwx
777 = rwx rwx rwx
765 = rwx rw- r-x
654 = rw- r-x r--
Examples
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
In the above-given terminal window, we have changed the
permissions of the file ‘sample to ‘764’.
• ‘764’ absolute code says the following:
• Owner can read, write and execute
• Usergroup can read and write
• World can only read
This is shown as ‘-rwxrw-r–
Symbolic Mode in Linux
• In the Absolute mode, you
change permissions for all 3
owners.
• In the symbolic mode, you can
modify permissions of a
specific owner.
• It makes use of mathematical
symbols to modify the Unix file
permissions.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Operator Description
+
Adds a permission to a file
or directory
– Removes the permission
=
Sets the permission and
overrides the permissions
set earlier.
Examples
• chmod 777 workfolder
• Will give read, write, and execute permissions for everyone.
• chmod 700 workfolder Will give read, write, and execute permission
for the user, but nothing to everyone else.
• chmod 327 workfolder Will give write and execute (3) permission for
the user, w (2) for the group, and (7) read, write, and execute for other
users.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Task
1. create 3 files with touch command: files1, files2, files3.
2. Write the command line by using letters with chmod to set the
following permissions:
- rwxrwxr-x for file1
- r-x—x—x for file2
- ——xrwx for file3
3. Write the command line by using numbers with chmod to set the
following permissions:
- rwxrwxrwx for file4 (you have to prepare this file)
- -w------- for file5 (you have to prepare this file)
- rwx--x—x for folder1 (you have to prepare this folder)
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
We will not be using permissions in numbers like 755 but
characters like rwx. Let’s look into an example
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
FAP ..
• For changing the ownership of a file/directory, you can use the
following command:
$ chown user filename
In case you want to change the user as well as group for a file or
directory use the command
$ chown user:group filename
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
chgrp group_name filename ‘chgrp’ stands for change group.
Examples.
1. Change the file permissions to read, write, and execute for the owner, and
only read for others:
chmod 755 myfile.txt
2. Change the file permissions to read and write for the owner, and read
only for others:
chmod 644 myfile.txt
3. Add execute permission for the owner of the file:
chmod +x myfile.txt
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Examples..
4. Remove write permission for others from a file:
chmod o-w myfile.txt
5. Change the ownership of a file to a specific user:
chown username myfile.txt
6. Change the ownership of a file to a specific user and group:
chown username:groupname myfile.txt
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
Examples…
4. Remove write permission for others from a file:
chmod o-w myfile.txt
5. Change the ownership of a file to a specific user:
chown username myfile.txt
6. Change the ownership of a file to a specific user and group:
chown username:groupname myfile.txt
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
FAP Summary
• Linux being a multi-user system uses permissions and ownership for
security.
• There are three user types on a Linux system viz. User, Group and Other
• Linux divides the file permissions into read, write and execute denoted by
r,w, and x
• The permissions on a file can be changed by ‘chmod’ command which can
be further divided into Absolute and Symbolic mode
• The ‘chown’ command can change the ownership of a file/directory. Use the
following commands: chown user file or chown user:group file
• The ‘chgrp’ command can change the group ownership chrgrp group
filename
• What does x – eXecuting a directory mean? A: Being allowed to “enter” a dir
and gain possible access to sub-dirs.
Linux
Laboratory
-
B.Tech.
6th
CSE
-
Dr.
D.
P.
Mishra,
BIT
Durg
File Access Permission

More Related Content

What's hot (20)

PPTX
3 d viewing projection
Pooja Dixit
 
PDF
Course 102: Lecture 4: Using Wild Cards
Ahmed El-Arabawy
 
PDF
Introduction to LaTeX - Workshop Day 1
Suddhasheel GHOSH, PhD
 
PPT
Fill area algorithms
Kumar
 
PPTX
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
rohitjasudkar
 
PDF
Find & Locate utility Linux
Bhavik Bhansali
 
PDF
Windows Registry Analysis
Himanshu0734
 
PPTX
DAA-Floyd Warshall Algorithm.pptx
ArbabMaalik
 
PDF
Machine learning Lecture 2
Srinivasan R
 
PDF
R data-import, data-export
FAO
 
PDF
Python libraries
Prof. Dr. K. Adisesha
 
PPTX
Computer Graphics - clipping
Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D
 
PPT
File system
Harleen Johal
 
PDF
Syntax Directed Definition and its applications
ShivanandManjaragi2
 
PDF
Users and groups in Linux
Knoldus Inc.
 
PDF
Token, Pattern and Lexeme
A. S. M. Shafi
 
PPT
Lecture 14 - Scope Rules
Md. Imran Hossain Showrov
 
PDF
Binary Search Tree
International Islamic University
 
DOC
Branch and bound
Nv Thejaswini
 
PPTX
L attribute in compiler design
khush_boo31
 
3 d viewing projection
Pooja Dixit
 
Course 102: Lecture 4: Using Wild Cards
Ahmed El-Arabawy
 
Introduction to LaTeX - Workshop Day 1
Suddhasheel GHOSH, PhD
 
Fill area algorithms
Kumar
 
Computer Graphics (Hidden surfaces and line removal, Curves and surfaces, Sur...
rohitjasudkar
 
Find & Locate utility Linux
Bhavik Bhansali
 
Windows Registry Analysis
Himanshu0734
 
DAA-Floyd Warshall Algorithm.pptx
ArbabMaalik
 
Machine learning Lecture 2
Srinivasan R
 
R data-import, data-export
FAO
 
Python libraries
Prof. Dr. K. Adisesha
 
File system
Harleen Johal
 
Syntax Directed Definition and its applications
ShivanandManjaragi2
 
Users and groups in Linux
Knoldus Inc.
 
Token, Pattern and Lexeme
A. S. M. Shafi
 
Lecture 14 - Scope Rules
Md. Imran Hossain Showrov
 
Branch and bound
Nv Thejaswini
 
L attribute in compiler design
khush_boo31
 

Similar to File Access Permission (20)

PPT
Linux files and file permission
U.P Police
 
PPTX
FILE PERMISSION OR ACCESS MODE
Vpmv
 
PPT
OS Unit IV.ppt
FarhanaMariyam1
 
PDF
Course 102: Lecture 14: Users and Permissions
Ahmed El-Arabawy
 
PPT
Basic Linux day 2
Saikumar Daram
 
PPT
PowerPoint Presentation Microsoft notes .ppt
okwalingajoe
 
PPTX
File permissions
Varnnit Jain
 
ODP
CS50x Permissions, Files, Users
Fábio Emilio Costa
 
PPTX
permissions.pptx computer science and tec
IqraHanif27
 
PPT
UNIX -File attributes and permissions; The Security Implications
RAVIRAJ P
 
PPTX
Access control list acl - permissions in linux
Sreenatha Reddy K R
 
PPTX
Filepermissions in linux
Subashini Pandiarajan
 
PDF
4_Users_and_File_Permission_and_Directory_Commands
Gautam Raja
 
PPTX
Topic 3-1_More_Linux_Commands.pptx
dulala3
 
PDF
Unit 4 user and group
root_fibo
 
PPTX
Ai module
KUMARRISHAV29
 
PDF
012-File-And-Directory-Permissions-Explained.pdf
ssuser584832
 
PDF
Linux for CS Majors
worr1244
 
PPTX
Introduction to linux day3
Gourav Varma
 
Linux files and file permission
U.P Police
 
FILE PERMISSION OR ACCESS MODE
Vpmv
 
OS Unit IV.ppt
FarhanaMariyam1
 
Course 102: Lecture 14: Users and Permissions
Ahmed El-Arabawy
 
Basic Linux day 2
Saikumar Daram
 
PowerPoint Presentation Microsoft notes .ppt
okwalingajoe
 
File permissions
Varnnit Jain
 
CS50x Permissions, Files, Users
Fábio Emilio Costa
 
permissions.pptx computer science and tec
IqraHanif27
 
UNIX -File attributes and permissions; The Security Implications
RAVIRAJ P
 
Access control list acl - permissions in linux
Sreenatha Reddy K R
 
Filepermissions in linux
Subashini Pandiarajan
 
4_Users_and_File_Permission_and_Directory_Commands
Gautam Raja
 
Topic 3-1_More_Linux_Commands.pptx
dulala3
 
Unit 4 user and group
root_fibo
 
Ai module
KUMARRISHAV29
 
012-File-And-Directory-Permissions-Explained.pdf
ssuser584832
 
Linux for CS Majors
worr1244
 
Introduction to linux day3
Gourav Varma
 
Ad

More from BIT DURG (20)

PDF
HTML_DOM
BIT DURG
 
PDF
JavaScript
BIT DURG
 
PDF
Understanding WWW
BIT DURG
 
PDF
Computer Networks
BIT DURG
 
PDF
Computer Basics
BIT DURG
 
PDF
ISDN & ATM
BIT DURG
 
PDF
Transport Control Protocol
BIT DURG
 
PDF
Routing Protocols
BIT DURG
 
PDF
Internet Protocol.pdf
BIT DURG
 
PDF
Intternetworking With TCP/IP
BIT DURG
 
PDF
Computer Network Basics
BIT DURG
 
PDF
MySQL
BIT DURG
 
PDF
Types of Linux Shells
BIT DURG
 
PDF
Control flow and related shell cripts
BIT DURG
 
PDF
Basic Shell Programs
BIT DURG
 
PDF
Filters & Vi Editor
BIT DURG
 
PDF
Basic Linux Commands
BIT DURG
 
PDF
Linux Installation
BIT DURG
 
PDF
Basics of GNU & Linux
BIT DURG
 
PDF
National youth day
BIT DURG
 
HTML_DOM
BIT DURG
 
JavaScript
BIT DURG
 
Understanding WWW
BIT DURG
 
Computer Networks
BIT DURG
 
Computer Basics
BIT DURG
 
ISDN & ATM
BIT DURG
 
Transport Control Protocol
BIT DURG
 
Routing Protocols
BIT DURG
 
Internet Protocol.pdf
BIT DURG
 
Intternetworking With TCP/IP
BIT DURG
 
Computer Network Basics
BIT DURG
 
MySQL
BIT DURG
 
Types of Linux Shells
BIT DURG
 
Control flow and related shell cripts
BIT DURG
 
Basic Shell Programs
BIT DURG
 
Filters & Vi Editor
BIT DURG
 
Basic Linux Commands
BIT DURG
 
Linux Installation
BIT DURG
 
Basics of GNU & Linux
BIT DURG
 
National youth day
BIT DURG
 
Ad

Recently uploaded (20)

PDF
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
PPTX
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
PDF
Zilliz Cloud Demo for performance and scale
Zilliz
 
PDF
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
PPTX
Introduction to Design of Machine Elements
PradeepKumarS27
 
PDF
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
PDF
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
PPTX
Innowell Capability B0425 - Commercial Buildings.pptx
regobertroza
 
PDF
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
PPTX
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
DOC
MRRS Strength and Durability of Concrete
CivilMythili
 
PPTX
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
PPTX
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
PPTX
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
PDF
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
PDF
monopile foundation seminar topic for civil engineering students
Ahina5
 
PDF
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
PDF
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
PDF
Water Design_Manual_2005. KENYA FOR WASTER SUPPLY AND SEWERAGE
DancanNgutuku
 
PPTX
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 
ARC--BUILDING-UTILITIES-2-PART-2 (1).pdf
IzzyBaniquedBusto
 
MPMC_Module-2 xxxxxxxxxxxxxxxxxxxxx.pptx
ShivanshVaidya5
 
Zilliz Cloud Demo for performance and scale
Zilliz
 
Unified_Cloud_Comm_Presentation anil singh ppt
anilsingh298751
 
Introduction to Design of Machine Elements
PradeepKumarS27
 
Statistical Data Analysis Using SPSS Software
shrikrishna kesharwani
 
Introduction to Productivity and Quality
মোঃ ফুরকান উদ্দিন জুয়েল
 
Innowell Capability B0425 - Commercial Buildings.pptx
regobertroza
 
POWER PLANT ENGINEERING (R17A0326).pdf..
haneefachosa123
 
Arduino Based Gas Leakage Detector Project
CircuitDigest
 
MRRS Strength and Durability of Concrete
CivilMythili
 
ISO/IEC JTC 1/WG 9 (MAR) Convenor Report
Kurata Takeshi
 
REINFORCEMENT AS CONSTRUCTION MATERIALS.pptx
mohaiminulhaquesami
 
265587293-NFPA 101 Life safety code-PPT-1.pptx
chandermwason
 
GTU Civil Engineering All Semester Syllabus.pdf
Vimal Bhojani
 
monopile foundation seminar topic for civil engineering students
Ahina5
 
International Journal of Information Technology Convergence and services (IJI...
ijitcsjournal4
 
MAD Unit - 2 Activity and Fragment Management in Android (Diploma IT)
JappanMavani
 
Water Design_Manual_2005. KENYA FOR WASTER SUPPLY AND SEWERAGE
DancanNgutuku
 
Break Statement in Programming with 6 Real Examples
manojpoojary2004
 

File Access Permission

  • 1. Dr. D. P. Mishra Digitally signed by Dr. D. P. Mishra DN: cn=Dr. D. P. Mishra, o=durg, ou=BIT, [email protected], c=IN Date: 2023.03.20 13:20:44 +05'30'
  • 2. File access permission • In Unix-like operating systems such as Linux, file access permissions are used to determine who can access a file and what actions they can perform on it. • There are three types of access permissions: • read (r), • write (w), and • execute (x). • These permissions can be set for three groups of users: • the file owner, • the group owner, and • others. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 3. FAP • The access permissions for a file can be viewed using the ls -l command, • It displays the file permissions as a string of ten characters. • The first character indicates the type of file (e.g., "-" for a regular file, "d" for a directory), • and the next three characters indicate the owner's permissions, • the following three indicate the group's permissions, and the • final three indicate the permissions for others. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 5. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg Let’s see file permissions in Linux with examples: Type ls – l on terminal gives $ ls - l Here, we have highlighted ‘-rw-rw-r–‘and this is permissions given to the owner, user group and the world. Here, the first ‘–‘ implies that we have selected a file
  • 6. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg if it is a directory, d would have been shown. The characters are pretty easy to remember. • r = read permission • w = write permission • x = execute permission • – = no permission
  • 7. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg The first part of the code is ‘rw-‘. This suggests that the owner ‘Home’ can: • Read the file • Write or edit the file • He cannot execute the file since the execute bit is set to ‘-‘.
  • 8. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg The second part is ‘rw-‘. It for the user group ‘Home’ and group-members can: • Read the file • Write or edit the file The third part is for the world which means any user. It says ‘r–‘. This means the user can only: • Read the file
  • 9. Changing FAP with chmod • Say you do not want your colleague to see your personal images. • This can be achieved by changing file permissions. • We can use the ‘chmod’ command which stands for ‘change mode’. • Using the command, we can set permissions (read, write, execute) on a file/directory for the owner, group and the world. Syntax: chmod permissions filename There are 2 ways to use the command 1. Absolute mode 2. Symbolic mode Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 10. Absolute(Numeric) Mode in Linux • In this mode, file permissions are not represented as characters but a three-digit octal number. • The table below gives numbers for all for permissions types. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg Number Permission Type Symbol 0 No Permission — 1 Execute –x 2 Write -w- 3 Execute + Write -wx 4 Read r– 5 Read + Execute r-x 6 Read +Write rw- 7 Read + Write +Execute rwx
  • 11. Permission in numeric mode • The above way of changing permissions will work fine but you may also need to know how to change permissions in numeric mode. • chmod is used in much the same way • instead of r, w, or x you will use numbers. • What are the numbers? • 0 = No Permission • 1 = Execute • 2 = Write • 4 = Read Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 12. The various owners are represented as – Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg User Denotations u user/owner g group o other a all
  • 14. Octal Table Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg binary octal permissions 000 0 --- 001 1 --x 010 2 -w- 011 3 -wx 100 4 r-- 101 5 r-x 110 6 rw- 111 7 rwx 777 = rwx rwx rwx 765 = rwx rw- r-x 654 = rw- r-x r--
  • 15. Examples Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg In the above-given terminal window, we have changed the permissions of the file ‘sample to ‘764’. • ‘764’ absolute code says the following: • Owner can read, write and execute • Usergroup can read and write • World can only read This is shown as ‘-rwxrw-r–
  • 16. Symbolic Mode in Linux • In the Absolute mode, you change permissions for all 3 owners. • In the symbolic mode, you can modify permissions of a specific owner. • It makes use of mathematical symbols to modify the Unix file permissions. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg Operator Description + Adds a permission to a file or directory – Removes the permission = Sets the permission and overrides the permissions set earlier.
  • 17. Examples • chmod 777 workfolder • Will give read, write, and execute permissions for everyone. • chmod 700 workfolder Will give read, write, and execute permission for the user, but nothing to everyone else. • chmod 327 workfolder Will give write and execute (3) permission for the user, w (2) for the group, and (7) read, write, and execute for other users. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 18. Task 1. create 3 files with touch command: files1, files2, files3. 2. Write the command line by using letters with chmod to set the following permissions: - rwxrwxr-x for file1 - r-x—x—x for file2 - ——xrwx for file3 3. Write the command line by using numbers with chmod to set the following permissions: - rwxrwxrwx for file4 (you have to prepare this file) - -w------- for file5 (you have to prepare this file) - rwx--x—x for folder1 (you have to prepare this folder) Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 19. We will not be using permissions in numbers like 755 but characters like rwx. Let’s look into an example Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 20. FAP .. • For changing the ownership of a file/directory, you can use the following command: $ chown user filename In case you want to change the user as well as group for a file or directory use the command $ chown user:group filename Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 23. Examples. 1. Change the file permissions to read, write, and execute for the owner, and only read for others: chmod 755 myfile.txt 2. Change the file permissions to read and write for the owner, and read only for others: chmod 644 myfile.txt 3. Add execute permission for the owner of the file: chmod +x myfile.txt Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 24. Examples.. 4. Remove write permission for others from a file: chmod o-w myfile.txt 5. Change the ownership of a file to a specific user: chown username myfile.txt 6. Change the ownership of a file to a specific user and group: chown username:groupname myfile.txt Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 25. Examples… 4. Remove write permission for others from a file: chmod o-w myfile.txt 5. Change the ownership of a file to a specific user: chown username myfile.txt 6. Change the ownership of a file to a specific user and group: chown username:groupname myfile.txt Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg
  • 26. FAP Summary • Linux being a multi-user system uses permissions and ownership for security. • There are three user types on a Linux system viz. User, Group and Other • Linux divides the file permissions into read, write and execute denoted by r,w, and x • The permissions on a file can be changed by ‘chmod’ command which can be further divided into Absolute and Symbolic mode • The ‘chown’ command can change the ownership of a file/directory. Use the following commands: chown user file or chown user:group file • The ‘chgrp’ command can change the group ownership chrgrp group filename • What does x – eXecuting a directory mean? A: Being allowed to “enter” a dir and gain possible access to sub-dirs. Linux Laboratory - B.Tech. 6th CSE - Dr. D. P. Mishra, BIT Durg