SlideShare a Scribd company logo
Users and Groups
Linux understands Users and Groups
A user can belong to several groups
A file can belong to only one user and one
group at a time
A particular user, the superuser “root” has extra
privileges (uid = “0” in /etc/passwd)
Only root can change the ownership of a file
Users and Groups cont.
User information in /etc/passwd
Password info is in /etc/shadow
Group information is in /etc/group
/etc/passwd and /etc/group divide data
fields using “:”
/etc/passwd:
joeuser:x:1000:1000:Joe User,,,:/home/joeuser:/bin/bash
/etc/group:
joeuser:x:1000:
A program runs...
A program may be run by a user, when the
system starts or by another process.
Before the program can execute the kernel
inspects several things:
• Is the file containing the program accessible to the user
or group of the process that wants to run it?
• Does the file containing the program permit execution
by that user or group (or anybody)?
• In most cases, while executing, a program inherits the
privileges of the user/process who started it.
A program in detail
When we type:
ls -l /usr/bin/top
We'll see:
-rwxr-xr-x 1 root root 68524 2011-12-19 07:18 /usr/bin/top
What does all this mean?
-r-xr-xr-x 1 root root 68524 2011-12-19 07:18 /usr/bin/top
---------- --- ------- ------- -------- ------------ -------------
| | | | | | |
| | | | | | File Name
| | | | | |
| | | | | +--- Modification Time/Date
| | | | |
| | | | +------------- Size (in bytes
| | | |
| | | +----------------------- Group
| | |
| | +-------------------------------- Owner
| |
| +-------------------------------------- “link count”
|
+---------------------------------------------- File Permissions
Group
The name of the group that has permissions in addition to the file's owner.
Owner
The name of the user who owns the file.
File Permissions
The first character is the type of file. A "-" indicates a regular (ordinary) file. A
"d” indicate a directory. Second set of 3 characters represent the read, write, and
execution rights of the file's owner. Next 3 represent the rights of the file's group, and
the final 3 represent the rights granted to everybody else.
(Example modified from http://www.linuxcommand.org/lts0030.php)
Access rights
Files are owned by a user and a group
(ownership)
Files have permissions for the user, the group,
and other
“other” permission is often referred to as “world”
The permissions are Read, Write and Execute
(R, W, X)
The user who owns a file is always allowed to
change its permissions
Some special cases
When looking at the output from “ls -l” in the
first column you might see:
d = directory
- = regular file
l = symbolic link
s = Unix domain socket
p = named pipe
c = character device file
b = block device file
Some special cases cont
In the Owner, Group and other columns you
might see:
s = setuid [when in Owner column]
s = setgid [when in Group column]
t = sticky bit [when at end]
Some References
http://www.tuxfiles.org/linuxhelp/filepermissions.html
http://www.cs.uregina.ca/Links/class-info/330/Linux/linux.html
http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html
There are two ways to set permissions when
using the chmod command:
Symbolic mode:
testfile has permissions of -r--r--r--
U G O*
$ chmod g+x testfile ==> -r--r-xr--
$ chmod u+wx testfile ==> -rwxr-xr--
$ chmod ug-x testfile ==> -rw--r--r--
U=user, G=group, O=other (world)
File permissions
Absolute mode:
We use octal (base eight) values represented like this:
Letter Permission Value
R read 4
W write 2
X execute 1
- none 0
For each column, User, Group or Other you can set
values from 0 to 7. Here is what each means:
0= --- 1= --x 2= -w- 3= -wx
4= r-- 5= r-x 6= rw- 7= rwx
File permissions cont.
Numeric mode cont:
Example index.html file with typical permission values:
$ chmod 755 index.html
$ ls -l index.html
-rwxr-xr-x 1 root wheel 0 May 24 06:20 index.html
$ chmod 644 index.html
$ ls -l index.html
-rw-r--r-- 1 root wheel 0 May 24 06:20 index.html
File permissions cont.
Two critical points:
1.The permissions of a directory affect whether
someone can see its contents or add or
remove files in it.
2.The permissions on a file determine what a
user can do to the data in the file.
Example:
If you don't have write permission for a directory, then
you can't delete a file in the directory. If you have write
access to the file you can update the data in the file.
Inherited permissions

More Related Content

PPTX
Access control list acl - permissions in linux
PDF
Course 102: Lecture 14: Users and Permissions
PPT
04-1-Linux.ppt
PPT
06 users groups_and_permissions
PPT
UNIX -File attributes and permissions; The Security Implications
ODP
CS50x Permissions, Files, Users
PPT
OS Unit IV.ppt
PPTX
File permissions
Access control list acl - permissions in linux
Course 102: Lecture 14: Users and Permissions
04-1-Linux.ppt
06 users groups_and_permissions
UNIX -File attributes and permissions; The Security Implications
CS50x Permissions, Files, Users
OS Unit IV.ppt
File permissions

Similar to permissions.pptx computer science and tec (20)

PPT
Host security
PPT
Host security
PPTX
Introduction to linux day3
PPTX
Topic 3-1_More_Linux_Commands.pptx
PPTX
Ai module
PDF
Exploitation and distribution of setuid and setgid binaries on Linux systems
PDF
Unit 4 user and group
PPT
PowerPoint Presentation Microsoft notes .ppt
PPT
Linux files and file permission
PPT
Unix Basics 04sp
PPT
Unix fundamentals
PDF
Basics of Linux Commands, Git and Github
PPT
Unix/Linux Basic Commands and Shell Script
PDF
Linux for CS Majors
PDF
4_Users_and_File_Permission_and_Directory_Commands
PPTX
FILE PERMISSION OR ACCESS MODE
PPT
4.5 manage file permissions and ownership v3
PDF
File Access Permission
PPT
intro unix/linux 09
Host security
Host security
Introduction to linux day3
Topic 3-1_More_Linux_Commands.pptx
Ai module
Exploitation and distribution of setuid and setgid binaries on Linux systems
Unit 4 user and group
PowerPoint Presentation Microsoft notes .ppt
Linux files and file permission
Unix Basics 04sp
Unix fundamentals
Basics of Linux Commands, Git and Github
Unix/Linux Basic Commands and Shell Script
Linux for CS Majors
4_Users_and_File_Permission_and_Directory_Commands
FILE PERMISSION OR ACCESS MODE
4.5 manage file permissions and ownership v3
File Access Permission
intro unix/linux 09
Ad

More from IqraHanif27 (18)

PPT
personalitymaslow.ppt important notes and
PDF
Lecture-02.pdf computer relationship easy
PDF
Lecture-01.pdf good lecture important notes
PPT
Quality Management.ppt in detail with notes
PPT
SPM.ppt details of spm project management
PPT
1588095888-intro.pptWeb Technologies and Tools (such as scripting tools) for ...
PPTX
link list.pptx complete notes detailed ans
PPTX
Lec10-Binary-Heaps-19122022-113509am.pptx
PPTX
Lec5-Doubly-Linked-List-24102022-110112am.pptx
PPTX
Lec12-Hash-Tables-27122022-125641pm.pptx
PPTX
NevigationMenu.pptx complete notes and types
PPTX
Chapter 3.pptx multimedia and conquer the same thing
PPTX
Chapter 2.pptx multimedia and the uses inlife
PPTX
Chapter 1.pptx multimedia and its uses in
PPTX
economics.pptx gross domastic product uses
PPT
Week 10-11 Managing Tablespaces and Data Files.ppt
PDF
Intro_Chapter_03B.pdf types of printers with example
PPT
ch1.ppt operating system from computer science for BSCs
personalitymaslow.ppt important notes and
Lecture-02.pdf computer relationship easy
Lecture-01.pdf good lecture important notes
Quality Management.ppt in detail with notes
SPM.ppt details of spm project management
1588095888-intro.pptWeb Technologies and Tools (such as scripting tools) for ...
link list.pptx complete notes detailed ans
Lec10-Binary-Heaps-19122022-113509am.pptx
Lec5-Doubly-Linked-List-24102022-110112am.pptx
Lec12-Hash-Tables-27122022-125641pm.pptx
NevigationMenu.pptx complete notes and types
Chapter 3.pptx multimedia and conquer the same thing
Chapter 2.pptx multimedia and the uses inlife
Chapter 1.pptx multimedia and its uses in
economics.pptx gross domastic product uses
Week 10-11 Managing Tablespaces and Data Files.ppt
Intro_Chapter_03B.pdf types of printers with example
ch1.ppt operating system from computer science for BSCs
Ad

Recently uploaded (20)

PPTX
building Planning Overview for step wise design.pptx
PDF
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
PPTX
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx
PPTX
Entrepreneur intro, origin, process, method
PPTX
Implications Existing phase plan and its feasibility.pptx
PPT
EGWHermeneuticsffgggggggggggggggggggggggggggggggg.ppt
PPTX
An introduction to AI in research and reference management
PPTX
Tenders & Contracts Works _ Services Afzal.pptx
PDF
YOW2022-BNE-MinimalViableArchitecture.pdf
PPTX
Special finishes, classification and types, explanation
PPTX
DOC-20250430-WA0014._20250714_235747_0000.pptx
PDF
GREEN BUILDING MATERIALS FOR SUISTAINABLE ARCHITECTURE AND BUILDING STUDY
PDF
UNIT 1 Introduction fnfbbfhfhfbdhdbdto Java.pptx.pdf
PPT
WHY_R12 Uaafafafpgradeaffafafafaffff.ppt
PDF
Skskkxiixijsjsnwkwkaksixindndndjdjdjsjjssk
PPTX
YV PROFILE PROJECTS PROFILE PRES. DESIGN
PDF
Urban Design Final Project-Site Analysis
PDF
Phone away, tabs closed: No multitasking
PDF
Integrated-2D-and-3D-Animation-Bridging-Dimensions-for-Impactful-Storytelling...
DOCX
actividad 20% informatica microsoft project
building Planning Overview for step wise design.pptx
Facade & Landscape Lighting Techniques and Trends.pptx.pdf
CLASS_11_BUSINESS_STUDIES_PPT_CHAPTER_1_Business_Trade_Commerce.pptx
Entrepreneur intro, origin, process, method
Implications Existing phase plan and its feasibility.pptx
EGWHermeneuticsffgggggggggggggggggggggggggggggggg.ppt
An introduction to AI in research and reference management
Tenders & Contracts Works _ Services Afzal.pptx
YOW2022-BNE-MinimalViableArchitecture.pdf
Special finishes, classification and types, explanation
DOC-20250430-WA0014._20250714_235747_0000.pptx
GREEN BUILDING MATERIALS FOR SUISTAINABLE ARCHITECTURE AND BUILDING STUDY
UNIT 1 Introduction fnfbbfhfhfbdhdbdto Java.pptx.pdf
WHY_R12 Uaafafafpgradeaffafafafaffff.ppt
Skskkxiixijsjsnwkwkaksixindndndjdjdjsjjssk
YV PROFILE PROJECTS PROFILE PRES. DESIGN
Urban Design Final Project-Site Analysis
Phone away, tabs closed: No multitasking
Integrated-2D-and-3D-Animation-Bridging-Dimensions-for-Impactful-Storytelling...
actividad 20% informatica microsoft project

permissions.pptx computer science and tec

  • 1. Users and Groups Linux understands Users and Groups A user can belong to several groups A file can belong to only one user and one group at a time A particular user, the superuser “root” has extra privileges (uid = “0” in /etc/passwd) Only root can change the ownership of a file
  • 2. Users and Groups cont. User information in /etc/passwd Password info is in /etc/shadow Group information is in /etc/group /etc/passwd and /etc/group divide data fields using “:” /etc/passwd: joeuser:x:1000:1000:Joe User,,,:/home/joeuser:/bin/bash /etc/group: joeuser:x:1000:
  • 3. A program runs... A program may be run by a user, when the system starts or by another process. Before the program can execute the kernel inspects several things: • Is the file containing the program accessible to the user or group of the process that wants to run it? • Does the file containing the program permit execution by that user or group (or anybody)? • In most cases, while executing, a program inherits the privileges of the user/process who started it.
  • 4. A program in detail When we type: ls -l /usr/bin/top We'll see: -rwxr-xr-x 1 root root 68524 2011-12-19 07:18 /usr/bin/top What does all this mean?
  • 5. -r-xr-xr-x 1 root root 68524 2011-12-19 07:18 /usr/bin/top ---------- --- ------- ------- -------- ------------ ------------- | | | | | | | | | | | | | File Name | | | | | | | | | | | +--- Modification Time/Date | | | | | | | | | +------------- Size (in bytes | | | | | | | +----------------------- Group | | | | | +-------------------------------- Owner | | | +-------------------------------------- “link count” | +---------------------------------------------- File Permissions Group The name of the group that has permissions in addition to the file's owner. Owner The name of the user who owns the file. File Permissions The first character is the type of file. A "-" indicates a regular (ordinary) file. A "d” indicate a directory. Second set of 3 characters represent the read, write, and execution rights of the file's owner. Next 3 represent the rights of the file's group, and the final 3 represent the rights granted to everybody else. (Example modified from http://www.linuxcommand.org/lts0030.php)
  • 6. Access rights Files are owned by a user and a group (ownership) Files have permissions for the user, the group, and other “other” permission is often referred to as “world” The permissions are Read, Write and Execute (R, W, X) The user who owns a file is always allowed to change its permissions
  • 7. Some special cases When looking at the output from “ls -l” in the first column you might see: d = directory - = regular file l = symbolic link s = Unix domain socket p = named pipe c = character device file b = block device file
  • 8. Some special cases cont In the Owner, Group and other columns you might see: s = setuid [when in Owner column] s = setgid [when in Group column] t = sticky bit [when at end] Some References http://www.tuxfiles.org/linuxhelp/filepermissions.html http://www.cs.uregina.ca/Links/class-info/330/Linux/linux.html http://www.onlamp.com/pub/a/bsd/2000/09/06/FreeBSD_Basics.html
  • 9. There are two ways to set permissions when using the chmod command: Symbolic mode: testfile has permissions of -r--r--r-- U G O* $ chmod g+x testfile ==> -r--r-xr-- $ chmod u+wx testfile ==> -rwxr-xr-- $ chmod ug-x testfile ==> -rw--r--r-- U=user, G=group, O=other (world) File permissions
  • 10. Absolute mode: We use octal (base eight) values represented like this: Letter Permission Value R read 4 W write 2 X execute 1 - none 0 For each column, User, Group or Other you can set values from 0 to 7. Here is what each means: 0= --- 1= --x 2= -w- 3= -wx 4= r-- 5= r-x 6= rw- 7= rwx File permissions cont.
  • 11. Numeric mode cont: Example index.html file with typical permission values: $ chmod 755 index.html $ ls -l index.html -rwxr-xr-x 1 root wheel 0 May 24 06:20 index.html $ chmod 644 index.html $ ls -l index.html -rw-r--r-- 1 root wheel 0 May 24 06:20 index.html File permissions cont.
  • 12. Two critical points: 1.The permissions of a directory affect whether someone can see its contents or add or remove files in it. 2.The permissions on a file determine what a user can do to the data in the file. Example: If you don't have write permission for a directory, then you can't delete a file in the directory. If you have write access to the file you can update the data in the file. Inherited permissions