SlideShare une entreprise Scribd logo
1  sur  13
Linux Tips: Files, Users & Permissions

Fabio Emilio Costa

http://plus.google.com/+FabioEmilioCosta
http://twitter.com/HufflepuffBR
http://www.facebook.com/fabiocosta0305
http://www.reddit.com/u/HufflepuffBR
Some History
●

Linux == Unix-Like

●

Quacks like duck, walks like duck, but no duck

●

Unix was created on 1960s

●

Multi-user

●

How avoid users to access forbidden files

●

Permissions

●

Groups

●

Everything is treated as a file on Unix (directories, devices)
Permissions
●

Read (4) – cat, cp ...

●

Write (2) – gedit, vi, emacs, rm..

●

eXecute (1) – run as programs (scripts)

●

Numbers were normally used

●

On directories:
–

Read: ls...

–

Write: touch, rm...

–

Execute: cd...
Users
●

Permissions are given on a file based on:
–
–

Group: people who are from the same group the owner;

–
●

User: who created the file (normally);
Others: nuff said...

ls -l shows all the normal permissions
Reading permissions on ls -l
File type
● - – common file
● d – directory
●
b – block device (disks)
●
c – character devices (terms)
● l – symbolic link
Owner's permissions
Group's permissions
Other's permissions
● read
● write
● execute
● - – unset permission

-rw-------
Users & Groups
●

All permissions are based on users

●

Normally indicated by either a name and/or a number

●

On appliance, jharvard is user 1000

●

Can be seen on /etc/passwd file

●

Users normally are parts of groups

●

Groups can be used for accounting, security, administration;

●

A user can be part of one or more groups;

●

jharvard is part of wheel group (can use sudo)

●

Can be seen on /etc/group file
Manipulating permissions
●

Changing Permissions: chmod (Change Mode);

●

Changing the Owner of a file: chown (Change Owner);

●

Changing the Group of a file: chgrp (Change Group);

●

Just root can chown and chgrp;
–

●

On older Linux and Unix, owner could chown and
chgrp, but that was a security risk (SetUID);

Only root and owner can chmod;
Changing permissions with chmod
●

By numbers: sum the permissions numbers. Each number
represents one into User, Group, Others (UGO)
–

●

Character indication: placing the needed permissions for a kind
after a = symbol;
–

●

chmod u=rw,go=w bar

Set/Unset: using the + symbol to set a permission and a –
symbol to unset a permission (easier method);
–

●

chmod 644 foo

chmod a+r,u+w baz

Special group: All
The root
●

Special user

●

Can do ANYTHING with a system...

●

… including break it

●

Has a special ID of 0

●

Many commands can be done just by root...

●

… or users that can use sudo, from wheel group …

●

… and jharvard is from wheel group
"With great power comes great
responsibility"
(PARKER, Ben)
Want to see Linux being broken?

Running rm -rf / on Linux

http://www.youtube.com/watch?v=D4fzInly
Don't try this at home!!!!!
Scripts
●

On Windows, files are opened based on extension;

●

.exe, .com, .bat – programs/scripts;

●

On Unix, needs eXecution permission to run as a script;

●

Any file with eXecution permission will be executed (if
possible);
THIS IS CS50

Contenu connexe

Tendances

Ubuntu Cheat Sheet
Ubuntu Cheat SheetUbuntu Cheat Sheet
Ubuntu Cheat Sheet
Serverless
 
Programming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nanoProgramming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nano
Yi-Chiao
 
Character_device_driver_bbb
Character_device_driver_bbbCharacter_device_driver_bbb
Character_device_driver_bbb
Rashila Rr
 
Open Source Public Workstations In Libraries
Open Source Public Workstations In LibrariesOpen Source Public Workstations In Libraries
Open Source Public Workstations In Libraries
Leonsagara
 

Tendances (20)

How to build and load linux to embedded system
How to build and load linux to embedded systemHow to build and load linux to embedded system
How to build and load linux to embedded system
 
Ubuntu Cheat Sheet
Ubuntu Cheat SheetUbuntu Cheat Sheet
Ubuntu Cheat Sheet
 
FUSE Filesystems
FUSE FilesystemsFUSE Filesystems
FUSE Filesystems
 
Can I write to a read only file ?
Can I write to a read only file ?Can I write to a read only file ?
Can I write to a read only file ?
 
[ETHCon Korea 2019] Kim jiyun 김지윤
[ETHCon Korea 2019] Kim jiyun 김지윤[ETHCon Korea 2019] Kim jiyun 김지윤
[ETHCon Korea 2019] Kim jiyun 김지윤
 
System administration
System administrationSystem administration
System administration
 
File then system
File then systemFile then system
File then system
 
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
Git&GitHub 를 이용한 버전관리와 협업 - 2.비교하기와 되돌리기
 
Dockerの準備
Dockerの準備Dockerの準備
Dockerの準備
 
Git installation
Git installationGit installation
Git installation
 
Cli2 Bibalex
Cli2 BibalexCli2 Bibalex
Cli2 Bibalex
 
Programming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nanoProgramming OpenRISC on Altera De0_nano
Programming OpenRISC on Altera De0_nano
 
Overview of linux kernel development
Overview of linux kernel developmentOverview of linux kernel development
Overview of linux kernel development
 
Why Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your ShellWhy Zsh is Cooler than Your Shell
Why Zsh is Cooler than Your Shell
 
Windows XP Professional Installation
Windows XP Professional  InstallationWindows XP Professional  Installation
Windows XP Professional Installation
 
Linux fundamental - Chap 11 boot
Linux fundamental - Chap 11 bootLinux fundamental - Chap 11 boot
Linux fundamental - Chap 11 boot
 
Writing file system in CPython
Writing file system in CPythonWriting file system in CPython
Writing file system in CPython
 
Character_device_driver_bbb
Character_device_driver_bbbCharacter_device_driver_bbb
Character_device_driver_bbb
 
Open Source Public Workstations In Libraries
Open Source Public Workstations In LibrariesOpen Source Public Workstations In Libraries
Open Source Public Workstations In Libraries
 
How to install Odoo 13 in Ubuntu ?
How to install Odoo 13 in Ubuntu ?How to install Odoo 13 in Ubuntu ?
How to install Odoo 13 in Ubuntu ?
 

En vedette

En vedette (8)

Creative Commons
Creative CommonsCreative Commons
Creative Commons
 
Palestra BrOffice.org
Palestra BrOffice.orgPalestra BrOffice.org
Palestra BrOffice.org
 
Portada Matematicas
Portada MatematicasPortada Matematicas
Portada Matematicas
 
Software livre mitos e verdades
Software livre   mitos e verdadesSoftware livre   mitos e verdades
Software livre mitos e verdades
 
GNU/Linux - uma alternativa (nova versão)
GNU/Linux - uma alternativa (nova versão)GNU/Linux - uma alternativa (nova versão)
GNU/Linux - uma alternativa (nova versão)
 
GNU/Linux - uma alternativa
GNU/Linux - uma alternativaGNU/Linux - uma alternativa
GNU/Linux - uma alternativa
 
Entendendo as regras do Jogo - Go e Software Livre
Entendendo as regras do Jogo - Go e Software LivreEntendendo as regras do Jogo - Go e Software Livre
Entendendo as regras do Jogo - Go e Software Livre
 
Study: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
 

Similaire à CS50x Permissions, Files, Users

Security coding c and c++ ch8 (1)
Security coding c and c++   ch8 (1)Security coding c and c++   ch8 (1)
Security coding c and c++ ch8 (1)
Chia-Hao Tsai
 
Linux: A Getting Started Presentation
Linux: A Getting Started PresentationLinux: A Getting Started Presentation
Linux: A Getting Started Presentation
Nap Ramirez
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
Ravikumar Nandigam
 

Similaire à CS50x Permissions, Files, Users (20)

Solaris basics
Solaris basicsSolaris basics
Solaris basics
 
Linux
LinuxLinux
Linux
 
Linux for Security Professionals (Tips and Tricks) - Init 6 10/2012
Linux for Security Professionals (Tips and Tricks) - Init 6 10/2012Linux for Security Professionals (Tips and Tricks) - Init 6 10/2012
Linux for Security Professionals (Tips and Tricks) - Init 6 10/2012
 
Linux
Linux Linux
Linux
 
Get Started with Linux Management Command line Basic Knowledge
Get Started with Linux Management Command line Basic KnowledgeGet Started with Linux Management Command line Basic Knowledge
Get Started with Linux Management Command line Basic Knowledge
 
Linux Getting Started
Linux Getting StartedLinux Getting Started
Linux Getting Started
 
An Introduction To Linux
An Introduction To LinuxAn Introduction To Linux
An Introduction To Linux
 
Rhel 6.2 complete ebook
Rhel 6.2  complete ebookRhel 6.2  complete ebook
Rhel 6.2 complete ebook
 
Rhel 6.2 complete ebook
Rhel 6.2 complete ebookRhel 6.2 complete ebook
Rhel 6.2 complete ebook
 
Security coding c and c++ ch8 (1)
Security coding c and c++   ch8 (1)Security coding c and c++   ch8 (1)
Security coding c and c++ ch8 (1)
 
Adhocr T-dose 2012
Adhocr T-dose 2012Adhocr T-dose 2012
Adhocr T-dose 2012
 
Users and groups in Linux
Users and groups in LinuxUsers and groups in Linux
Users and groups in Linux
 
Course 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and PermissionsCourse 102: Lecture 14: Users and Permissions
Course 102: Lecture 14: Users and Permissions
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
beginner.en.print
beginner.en.printbeginner.en.print
beginner.en.print
 
Linux: A Getting Started Presentation
Linux: A Getting Started PresentationLinux: A Getting Started Presentation
Linux: A Getting Started Presentation
 
Host security
Host securityHost security
Host security
 
Host security
Host securityHost security
Host security
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
 

Dernier

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 

Dernier (20)

Philosophy of china and it's charactistics
Philosophy of china and it's charactisticsPhilosophy of china and it's charactistics
Philosophy of china and it's charactistics
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptxExploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
Exploring_the_Narrative_Style_of_Amitav_Ghoshs_Gun_Island.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17How to Add New Custom Addons Path in Odoo 17
How to Add New Custom Addons Path in Odoo 17
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
latest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answerslatest AZ-104 Exam Questions and Answers
latest AZ-104 Exam Questions and Answers
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 

CS50x Permissions, Files, Users

  • 1. Linux Tips: Files, Users & Permissions Fabio Emilio Costa http://plus.google.com/+FabioEmilioCosta http://twitter.com/HufflepuffBR http://www.facebook.com/fabiocosta0305 http://www.reddit.com/u/HufflepuffBR
  • 2. Some History ● Linux == Unix-Like ● Quacks like duck, walks like duck, but no duck ● Unix was created on 1960s ● Multi-user ● How avoid users to access forbidden files ● Permissions ● Groups ● Everything is treated as a file on Unix (directories, devices)
  • 3. Permissions ● Read (4) – cat, cp ... ● Write (2) – gedit, vi, emacs, rm.. ● eXecute (1) – run as programs (scripts) ● Numbers were normally used ● On directories: – Read: ls... – Write: touch, rm... – Execute: cd...
  • 4. Users ● Permissions are given on a file based on: – – Group: people who are from the same group the owner; – ● User: who created the file (normally); Others: nuff said... ls -l shows all the normal permissions
  • 5. Reading permissions on ls -l File type ● - – common file ● d – directory ● b – block device (disks) ● c – character devices (terms) ● l – symbolic link Owner's permissions Group's permissions Other's permissions ● read ● write ● execute ● - – unset permission -rw-------
  • 6. Users & Groups ● All permissions are based on users ● Normally indicated by either a name and/or a number ● On appliance, jharvard is user 1000 ● Can be seen on /etc/passwd file ● Users normally are parts of groups ● Groups can be used for accounting, security, administration; ● A user can be part of one or more groups; ● jharvard is part of wheel group (can use sudo) ● Can be seen on /etc/group file
  • 7. Manipulating permissions ● Changing Permissions: chmod (Change Mode); ● Changing the Owner of a file: chown (Change Owner); ● Changing the Group of a file: chgrp (Change Group); ● Just root can chown and chgrp; – ● On older Linux and Unix, owner could chown and chgrp, but that was a security risk (SetUID); Only root and owner can chmod;
  • 8. Changing permissions with chmod ● By numbers: sum the permissions numbers. Each number represents one into User, Group, Others (UGO) – ● Character indication: placing the needed permissions for a kind after a = symbol; – ● chmod u=rw,go=w bar Set/Unset: using the + symbol to set a permission and a – symbol to unset a permission (easier method); – ● chmod 644 foo chmod a+r,u+w baz Special group: All
  • 9. The root ● Special user ● Can do ANYTHING with a system... ● … including break it ● Has a special ID of 0 ● Many commands can be done just by root... ● … or users that can use sudo, from wheel group … ● … and jharvard is from wheel group
  • 10. "With great power comes great responsibility" (PARKER, Ben)
  • 11. Want to see Linux being broken? Running rm -rf / on Linux http://www.youtube.com/watch?v=D4fzInly Don't try this at home!!!!!
  • 12. Scripts ● On Windows, files are opened based on extension; ● .exe, .com, .bat – programs/scripts; ● On Unix, needs eXecution permission to run as a script; ● Any file with eXecution permission will be executed (if possible);