SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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 ?
 

Andere mochten auch

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
ssuserdda66b
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Kürzlich hochgeladen (20)

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)
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
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...
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
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Ữ Â...
 
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
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
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
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 

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);