SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Chapter 2Chapter 2
File PermissionFile Permission
Ref. Pge. 194
Listing a file permissionListing a file permission
●
ls -l 1.txtls -l 1.txt
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
File TypeFile Type
-- : Regular File: Regular File
ASCII textASCII text
executableexecutable
datadata
dd : Directory: Directory
ll : Symbolic Link: Symbolic Link
cc : Character Device: Character Device
bb : Block Device: Block Device
ss : Socket: Socket
pp : Named Pipe(FIFO): Named Pipe(FIFO)
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
Permission ModePermission Mode
rw-r--r--rw-r--r--
rw-rw- : owner permission: owner permission
r--r--: group permission: group permission
r--r--: others permission: others permission
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
Link CounterLink Counter
11 :: Only one name for this fileOnly one name for this file
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
OwnershipOwnership
kennykenny :: user(owner) nameuser(owner) name
usersusers :: group namegroup name
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
File SizeFile Size
4141 :: 41 bytes41 bytes
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
Time StampTime Stamp
Jan 25 07:53Jan 25 07:53 : Modification time: Modification time
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
File NameFile Name
1.txt1.txt : File Name: File Name
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
Permission DeterminationPermission Determination
1st:1st: u (owner):u (owner):
While the UID matches the owner,While the UID matches the owner,
using theusing the first THREE characters.first THREE characters.
2nd:2nd: g (group):g (group):
WWhile one of the GID(s) matches the group,hile one of the GID(s) matches the group,
using the middle THREE characters.using the middle THREE characters.
3rd:3rd: o (others)o (others)
Neither of above,Neither of above,
using the last THREE characters.using the last THREE characters.
-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
Permission DeterminationPermission Determination
rr : read: read
ww : write: write
xx : execute: execute
-- : off: off
Meaning of PermissionMeaning of Permission
rr ww xx
FileFile
Can read theCan read the
content ofcontent of
file.file.
Can modifyCan modify
the contentthe content
of file.of file.
Can run theCan run the
program orprogram or
script.script.
DirectoryDirectory
Can list fileCan list file
names innames in
directory.directory.
Can create,Can create,
delete, anddelete, and
rename filesrename files
in directory.in directory.
Can accessCan access
into theinto the
directory.directory.
Ref. Pge. 197
Permission ModePermission Mode
●
Binary mode:Binary mode:
9 bits9 bits: 110100100: 110100100
11 : on: on
00 : off: off
Permission ModePermission Mode
●
Text mode:Text mode:
9 characters : rw-r--r--9 characters : rw-r--r--
1 :1 : rwxrwx
0 :0 : --
Permission ModePermission Mode
●
Octal mode:Octal mode:
3 digits3 digits : 644: 644
OctalOctal ValueValue TextText
0 0 00 0 0
0 0 10 0 1
0 1 00 1 0
0 1 10 1 1
1 0 01 0 0
1 0 11 0 1
1 1 01 1 0
1 1 11 1 1
00
11
22
33
44
55
66
77
­­­­­­
­­x­­x
­w­­w­
­wx­wx
r­­r­­
r­xr­x
rw­rw­
rwxrwx
Ref. Pge. 196
Changing Permission ModeChanging Permission Mode
●
Octal mode:Octal mode:
chmod 644 1.txtchmod 644 1.txt
Ref. Pge. 199
Changing Permission ModeChanging Permission Mode
●
Text mode:Text mode:
chmod u=rw,go=r 1.txtchmod u=rw,go=r 1.txt
WhomWhom HowHow WhatWhat
uu
gg
oo
aa
++
--
==
rr
ww
xx
Special PermissionSpecial Permission
Ref. Pge. 197
SUIDSUID
(100)(100)
SGIDSGID
(010)(010)
Sticky BitSticky Bit
(001)(001)
FileFile
(binary only)(binary only)
The process UIDThe process UID
will not get fromwill not get from
user, it inheritsuser, it inherits
from the file'sfrom the file's
owner instead.owner instead.
The process GIDThe process GID
will not get fromwill not get from
user's group, butuser's group, but
from the group offrom the group of
file.file.
--
DirectoryDirectory --
Any new file or subAny new file or sub
directory will getdirectory will get
the same group asthe same group as
directory. New subdirectory. New sub
directory inheritsdirectory inherits
the SGID as well.the SGID as well.
Only root andOnly root and
the owner ofthe owner of
file orfile or
directory anddirectory and
remove file inremove file in
directory.directory.
Changing Special PermissionChanging Special Permission
●
Octal mode:Octal mode:
chmod <Nnnn> filechmod <Nnnn> file
Text mode:Text mode:
chmod [ug][+-][s] filechmod [ug][+-][s] file
chmod o[+-]t filechmod o[+-]t file
Ref. Pge. 193
Determination ofDetermination of
Special PermissionSpecial Permission
        rwxrws­­Trwxrws­­T
  011111111000 011111111000 
( 6  7  7  0 )( 6  7  7  0 )
[st] : replace x[st] : replace x
[ST] : replace -[ST] : replace -
Ref. Pge. 193
Changing OwnershipChanging Ownership
●
Changing a File's Owner:Changing a File's Owner:
chown alex 1.txtchown alex 1.txt
●
Requirement:Requirement:
●
root onlyroot only
Ref. Pge. 193
Changing OwnershipChanging Ownership
●
Changing a File's Group:Changing a File's Group:
chown :group1 1.txtchown :group1 1.txt
chgrp group1 1.txtchgrp group1 1.txt
●
Requirement:Requirement:
●
root, orroot, or
●
file owner, must belongs to the target groupfile owner, must belongs to the target group
Changing OwnershipChanging Ownership
●
Changing both Owner and Group:Changing both Owner and Group:
chown alex:group1 1.txtchown alex:group1 1.txt
●
Requirement:Requirement:
●
root onlyroot only
Default PermissionDefault Permission
●
Default permission for new file:Default permission for new file:
06660666
●
Default permission for new directory:Default permission for new directory:
07770777
Ref. Pge. 202
Changing Default PermissionChanging Default Permission
●
Using theUsing the umaskumask command:command:
umaskumask : list the current umask value: list the current umask value
umask nnnumask nnn : change the umask value: change the umask value
Meaning of umask valueMeaning of umask value
●
To remove specified permissionTo remove specified permission
from default:from default:
file default:file default: 000 110 110 110000 110 110 110
mask value:mask value: 000 000 010 010000 000 010 010
file result:file result: 000 110 100 100000 110 100 100
11 : removed: removed
00 : unchanged: unchanged
dir result:dir result: 000 111 101 101000 111 101 101

Mais conteúdo relacionado

Mais procurados

Linux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comLinux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comGreen Ecosystem
 
Encoding errors
Encoding errorsEncoding errors
Encoding errorszeu1507
 
4.1 create partitions and filesystems
4.1 create partitions and filesystems4.1 create partitions and filesystems
4.1 create partitions and filesystemsAcácio Oliveira
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file managementAcácio Oliveira
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layoutAcácio Oliveira
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file managementAcácio Oliveira
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2Acácio Oliveira
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystemsAcácio Oliveira
 
Linux training
Linux trainingLinux training
Linux trainingartisriva
 
101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystemsAcácio Oliveira
 
101 2.4 use debian package management
101 2.4 use debian package management101 2.4 use debian package management
101 2.4 use debian package managementAcácio Oliveira
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commandsaaj_sarkar06
 

Mais procurados (20)

Rpm Introduction
Rpm IntroductionRpm Introduction
Rpm Introduction
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Linux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comLinux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.com
 
Encoding errors
Encoding errorsEncoding errors
Encoding errors
 
4.1 create partitions and filesystems
4.1 create partitions and filesystems4.1 create partitions and filesystems
4.1 create partitions and filesystems
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
3.3 perform basic file management
3.3 perform basic file management3.3 perform basic file management
3.3 perform basic file management
 
101 2.1 design hard disk layout
101 2.1 design hard disk layout101 2.1 design hard disk layout
101 2.1 design hard disk layout
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
101 3.3 perform basic file management
101 3.3 perform basic file management101 3.3 perform basic file management
101 3.3 perform basic file management
 
1.2 boot the system v2
1.2 boot the system v21.2 boot the system v2
1.2 boot the system v2
 
Linux_commands
Linux_commandsLinux_commands
Linux_commands
 
101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2101 2.1 design hard disk layout v2
101 2.1 design hard disk layout v2
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
Raj linux
Raj linux Raj linux
Raj linux
 
Linux training
Linux trainingLinux training
Linux training
 
Ha opensuse
Ha opensuseHa opensuse
Ha opensuse
 
101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems101 4.3 control mounting and unmounting of filesystems
101 4.3 control mounting and unmounting of filesystems
 
101 2.4 use debian package management
101 2.4 use debian package management101 2.4 use debian package management
101 2.4 use debian package management
 
Some basic unix commands
Some basic unix commandsSome basic unix commands
Some basic unix commands
 

Destaque

Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on praticeKenny (netman)
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementKenny (netman)
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterKenny (netman)
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgKenny (netman)
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingKenny (netman)
 
Docker on Windows
Docker on WindowsDocker on Windows
Docker on WindowsCarl Su
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procKenny (netman)
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginnersCorrie Watt
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxKenny (netman)
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Sauce Labs
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viKenny (netman)
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08Tushar Jain
 
Linux pipe & redirection
Linux pipe & redirectionLinux pipe & redirection
Linux pipe & redirectionColin Su
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueKenny (netman)
 
Ras pioverview
Ras pioverviewRas pioverview
Ras pioverviewAlec Clews
 

Destaque (20)

Linux network monitoring hands-on pratice
Linux network monitoring hands-on praticeLinux network monitoring hands-on pratice
Linux network monitoring hands-on pratice
 
Linux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account managementLinux fundamental - Chap 13 account management
Linux fundamental - Chap 13 account management
 
Linux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filterLinux fundamental - Chap 05 filter
Linux fundamental - Chap 05 filter
 
Linux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkgLinux fundamental - Chap 09 pkg
Linux fundamental - Chap 09 pkg
 
Importance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation readingImportance of linux system fundamental in technical documentation reading
Importance of linux system fundamental in technical documentation reading
 
Docker on Windows
Docker on WindowsDocker on Windows
Docker on Windows
 
Windows7 Vs Linux
Windows7 Vs LinuxWindows7 Vs Linux
Windows7 Vs Linux
 
Linux fundamental - Chap 08 proc
Linux fundamental - Chap 08 procLinux fundamental - Chap 08 proc
Linux fundamental - Chap 08 proc
 
Linux CLI
Linux CLILinux CLI
Linux CLI
 
The linux command line for total beginners
The linux command line  for total beginnersThe linux command line  for total beginners
The linux command line for total beginners
 
Linux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regxLinux fundamental - Chap 06 regx
Linux fundamental - Chap 06 regx
 
Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)Using Selenium to Test Native Apps (Wait, you can do that?)
Using Selenium to Test Native Apps (Wait, you can do that?)
 
Linux fundamental - Chap 07 vi
Linux fundamental - Chap 07 viLinux fundamental - Chap 07 vi
Linux fundamental - Chap 07 vi
 
Unix tutorial-08
Unix tutorial-08Unix tutorial-08
Unix tutorial-08
 
Linux pipe & redirection
Linux pipe & redirectionLinux pipe & redirection
Linux pipe & redirection
 
Chap 18 net
Chap 18 netChap 18 net
Chap 18 net
 
Linux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System RescueLinux fundamental - Chap 16 System Rescue
Linux fundamental - Chap 16 System Rescue
 
Ras pioverview
Ras pioverviewRas pioverview
Ras pioverview
 
Chap 17 advfs
Chap 17 advfsChap 17 advfs
Chap 17 advfs
 
Basics of-linux
Basics of-linuxBasics of-linux
Basics of-linux
 

Semelhante a File Permission and Ownership in Linux

FILE PERMISSION OR ACCESS MODE
 FILE PERMISSION OR ACCESS MODE FILE PERMISSION OR ACCESS MODE
FILE PERMISSION OR ACCESS MODEVpmv
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentalsDima Gomaa
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Previewleminhvuong
 
File permission in Linux
File permission in LinuxFile permission in Linux
File permission in LinuxKrutikMandre1
 
012-File-And-Directory-Permissions-Explained.pdf
012-File-And-Directory-Permissions-Explained.pdf012-File-And-Directory-Permissions-Explained.pdf
012-File-And-Directory-Permissions-Explained.pdfssuser584832
 
Special permission in linux.
Special permission in linux.Special permission in linux.
Special permission in linux.Md Meherab Hossen
 
Advanced file permissions in linux
Advanced file permissions in linuxAdvanced file permissions in linux
Advanced file permissions in linuxMohit Singh
 
4_Users_and_File_Permission_and_Directory_Commands
4_Users_and_File_Permission_and_Directory_Commands4_Users_and_File_Permission_and_Directory_Commands
4_Users_and_File_Permission_and_Directory_CommandsGautam Raja
 
File Access Permission
File Access PermissionFile Access Permission
File Access PermissionBIT DURG
 
04-1-Linux.ppt
04-1-Linux.ppt04-1-Linux.ppt
04-1-Linux.pptEidTahir
 
Linux for CS Majors
Linux for CS MajorsLinux for CS Majors
Linux for CS Majorsworr1244
 
Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxSadia Bashir
 
Rhel 6.2 complete ebook
Rhel 6.2 complete ebookRhel 6.2 complete ebook
Rhel 6.2 complete ebookYash Gulati
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administratorDinesh jaisankar
 
2023comp90024_linux2.pdf
2023comp90024_linux2.pdf2023comp90024_linux2.pdf
2023comp90024_linux2.pdfLevLafayette1
 

Semelhante a File Permission and Ownership in Linux (20)

FILE PERMISSION OR ACCESS MODE
 FILE PERMISSION OR ACCESS MODE FILE PERMISSION OR ACCESS MODE
FILE PERMISSION OR ACCESS MODE
 
Unix fundamentals
Unix fundamentalsUnix fundamentals
Unix fundamentals
 
Basic Linux
Basic LinuxBasic Linux
Basic Linux
 
Lession1 Linux Preview
Lession1 Linux PreviewLession1 Linux Preview
Lession1 Linux Preview
 
Linux
LinuxLinux
Linux
 
File permission in Linux
File permission in LinuxFile permission in Linux
File permission in Linux
 
012-File-And-Directory-Permissions-Explained.pdf
012-File-And-Directory-Permissions-Explained.pdf012-File-And-Directory-Permissions-Explained.pdf
012-File-And-Directory-Permissions-Explained.pdf
 
Special permission in linux.
Special permission in linux.Special permission in linux.
Special permission in linux.
 
Advanced file permissions in linux
Advanced file permissions in linuxAdvanced file permissions in linux
Advanced file permissions in linux
 
4_Users_and_File_Permission_and_Directory_Commands
4_Users_and_File_Permission_and_Directory_Commands4_Users_and_File_Permission_and_Directory_Commands
4_Users_and_File_Permission_and_Directory_Commands
 
File Access Permission
File Access PermissionFile Access Permission
File Access Permission
 
Sticky bit suid sgid
Sticky bit suid sgidSticky bit suid sgid
Sticky bit suid sgid
 
Unix Basics Commands
Unix Basics CommandsUnix Basics Commands
Unix Basics Commands
 
04-1-Linux.ppt
04-1-Linux.ppt04-1-Linux.ppt
04-1-Linux.ppt
 
Linux for CS Majors
Linux for CS MajorsLinux for CS Majors
Linux for CS Majors
 
Lesson 3 Working with Files in Linux
Lesson 3 Working with Files in LinuxLesson 3 Working with Files in Linux
Lesson 3 Working with Files in Linux
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Rhel 6.2 complete ebook
Rhel 6.2 complete ebookRhel 6.2 complete ebook
Rhel 6.2 complete ebook
 
Most frequently used unix commands for database administrator
Most frequently used unix commands for database administratorMost frequently used unix commands for database administrator
Most frequently used unix commands for database administrator
 
2023comp90024_linux2.pdf
2023comp90024_linux2.pdf2023comp90024_linux2.pdf
2023comp90024_linux2.pdf
 

Mais de Kenny (netman)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration stepsKenny (netman)
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingKenny (netman)
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptKenny (netman)
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementKenny (netman)
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootKenny (netman)
 
Linux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shellLinux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shellKenny (netman)
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network MonitoringKenny (netman)
 

Mais de Kenny (netman) (14)

rpi_audio configuration steps
rpi_audio configuration stepsrpi_audio configuration steps
rpi_audio configuration steps
 
Rpi audio
Rpi audioRpi audio
Rpi audio
 
Chap 19 web
Chap 19 webChap 19 web
Chap 19 web
 
About the Course
About the CourseAbout the Course
About the Course
 
Linux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job SchedulingLinux fundamental - Chap 15 Job Scheduling
Linux fundamental - Chap 15 Job Scheduling
 
Linux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell scriptLinux fundamental - Chap 14 shell script
Linux fundamental - Chap 14 shell script
 
Linux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware ManagementLinux fundamental - Chap 12 Hardware Management
Linux fundamental - Chap 12 Hardware Management
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 boot
 
Linux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shellLinux fundamental - Chap 00 shell
Linux fundamental - Chap 00 shell
 
Linux system security
Linux system securityLinux system security
Linux system security
 
Linux Network Monitoring
Linux Network MonitoringLinux Network Monitoring
Linux Network Monitoring
 
加密應用(GPG)
加密應用(GPG)加密應用(GPG)
加密應用(GPG)
 
金鑰管理 (PKI)
金鑰管理 (PKI)金鑰管理 (PKI)
金鑰管理 (PKI)
 
Linux firewall
Linux firewallLinux firewall
Linux firewall
 

Último

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 

Último (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

File Permission and Ownership in Linux

  • 1. Chapter 2Chapter 2 File PermissionFile Permission Ref. Pge. 194
  • 2. Listing a file permissionListing a file permission ● ls -l 1.txtls -l 1.txt -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 3. File TypeFile Type -- : Regular File: Regular File ASCII textASCII text executableexecutable datadata dd : Directory: Directory ll : Symbolic Link: Symbolic Link cc : Character Device: Character Device bb : Block Device: Block Device ss : Socket: Socket pp : Named Pipe(FIFO): Named Pipe(FIFO) -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 4. Permission ModePermission Mode rw-r--r--rw-r--r-- rw-rw- : owner permission: owner permission r--r--: group permission: group permission r--r--: others permission: others permission -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 5. Link CounterLink Counter 11 :: Only one name for this fileOnly one name for this file -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 6. OwnershipOwnership kennykenny :: user(owner) nameuser(owner) name usersusers :: group namegroup name -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 7. File SizeFile Size 4141 :: 41 bytes41 bytes -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 8. Time StampTime Stamp Jan 25 07:53Jan 25 07:53 : Modification time: Modification time -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 9. File NameFile Name 1.txt1.txt : File Name: File Name -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 10. Permission DeterminationPermission Determination 1st:1st: u (owner):u (owner): While the UID matches the owner,While the UID matches the owner, using theusing the first THREE characters.first THREE characters. 2nd:2nd: g (group):g (group): WWhile one of the GID(s) matches the group,hile one of the GID(s) matches the group, using the middle THREE characters.using the middle THREE characters. 3rd:3rd: o (others)o (others) Neither of above,Neither of above, using the last THREE characters.using the last THREE characters. -rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt-rw-r--r-- 1 kenny users 41 Jan 25 07:52 1.txt
  • 11. Permission DeterminationPermission Determination rr : read: read ww : write: write xx : execute: execute -- : off: off
  • 12. Meaning of PermissionMeaning of Permission rr ww xx FileFile Can read theCan read the content ofcontent of file.file. Can modifyCan modify the contentthe content of file.of file. Can run theCan run the program orprogram or script.script. DirectoryDirectory Can list fileCan list file names innames in directory.directory. Can create,Can create, delete, anddelete, and rename filesrename files in directory.in directory. Can accessCan access into theinto the directory.directory. Ref. Pge. 197
  • 13. Permission ModePermission Mode ● Binary mode:Binary mode: 9 bits9 bits: 110100100: 110100100 11 : on: on 00 : off: off
  • 14. Permission ModePermission Mode ● Text mode:Text mode: 9 characters : rw-r--r--9 characters : rw-r--r-- 1 :1 : rwxrwx 0 :0 : --
  • 15. Permission ModePermission Mode ● Octal mode:Octal mode: 3 digits3 digits : 644: 644 OctalOctal ValueValue TextText 0 0 00 0 0 0 0 10 0 1 0 1 00 1 0 0 1 10 1 1 1 0 01 0 0 1 0 11 0 1 1 1 01 1 0 1 1 11 1 1 00 11 22 33 44 55 66 77 ­­­­­­ ­­x­­x ­w­­w­ ­wx­wx r­­r­­ r­xr­x rw­rw­ rwxrwx Ref. Pge. 196
  • 16. Changing Permission ModeChanging Permission Mode ● Octal mode:Octal mode: chmod 644 1.txtchmod 644 1.txt Ref. Pge. 199
  • 17. Changing Permission ModeChanging Permission Mode ● Text mode:Text mode: chmod u=rw,go=r 1.txtchmod u=rw,go=r 1.txt WhomWhom HowHow WhatWhat uu gg oo aa ++ -- == rr ww xx
  • 18. Special PermissionSpecial Permission Ref. Pge. 197 SUIDSUID (100)(100) SGIDSGID (010)(010) Sticky BitSticky Bit (001)(001) FileFile (binary only)(binary only) The process UIDThe process UID will not get fromwill not get from user, it inheritsuser, it inherits from the file'sfrom the file's owner instead.owner instead. The process GIDThe process GID will not get fromwill not get from user's group, butuser's group, but from the group offrom the group of file.file. -- DirectoryDirectory -- Any new file or subAny new file or sub directory will getdirectory will get the same group asthe same group as directory. New subdirectory. New sub directory inheritsdirectory inherits the SGID as well.the SGID as well. Only root andOnly root and the owner ofthe owner of file orfile or directory anddirectory and remove file inremove file in directory.directory.
  • 19. Changing Special PermissionChanging Special Permission ● Octal mode:Octal mode: chmod <Nnnn> filechmod <Nnnn> file Text mode:Text mode: chmod [ug][+-][s] filechmod [ug][+-][s] file chmod o[+-]t filechmod o[+-]t file Ref. Pge. 193
  • 20. Determination ofDetermination of Special PermissionSpecial Permission         rwxrws­­Trwxrws­­T   011111111000 011111111000  ( 6  7  7  0 )( 6  7  7  0 ) [st] : replace x[st] : replace x [ST] : replace -[ST] : replace - Ref. Pge. 193
  • 21. Changing OwnershipChanging Ownership ● Changing a File's Owner:Changing a File's Owner: chown alex 1.txtchown alex 1.txt ● Requirement:Requirement: ● root onlyroot only Ref. Pge. 193
  • 22. Changing OwnershipChanging Ownership ● Changing a File's Group:Changing a File's Group: chown :group1 1.txtchown :group1 1.txt chgrp group1 1.txtchgrp group1 1.txt ● Requirement:Requirement: ● root, orroot, or ● file owner, must belongs to the target groupfile owner, must belongs to the target group
  • 23. Changing OwnershipChanging Ownership ● Changing both Owner and Group:Changing both Owner and Group: chown alex:group1 1.txtchown alex:group1 1.txt ● Requirement:Requirement: ● root onlyroot only
  • 24. Default PermissionDefault Permission ● Default permission for new file:Default permission for new file: 06660666 ● Default permission for new directory:Default permission for new directory: 07770777 Ref. Pge. 202
  • 25. Changing Default PermissionChanging Default Permission ● Using theUsing the umaskumask command:command: umaskumask : list the current umask value: list the current umask value umask nnnumask nnn : change the umask value: change the umask value
  • 26. Meaning of umask valueMeaning of umask value ● To remove specified permissionTo remove specified permission from default:from default: file default:file default: 000 110 110 110000 110 110 110 mask value:mask value: 000 000 010 010000 000 010 010 file result:file result: 000 110 100 100000 110 100 100 11 : removed: removed 00 : unchanged: unchanged dir result:dir result: 000 111 101 101000 111 101 101