1 / 18

Date: MON 18/03/1432

Lecture 1. Security & permissions commands. Date: MON 18/03/1432. Umask(U ser Mask. Umask abbreviation of u ser mask Is a command to set the file mode creation mask ( Umask ) sets the file-creation permissions. Umask(U ser Mask. Symbolic mask: Umask -S

dinah
Télécharger la présentation

Date: MON 18/03/1432

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Lecture 1 Security & permissions commands Date: MON 18/03/1432 Ustaza. Imtithal Alnour Saeed & UstazaSana AL-Hwishel

  2. Umask(User Mask • Umask abbreviation of user mask • Is a command to set the file mode creation mask • (Umask) sets the file-creation permissions Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  3. Umask(User Mask Symbolic mask: Umask -S • displays the existing default value for new files • For example the result of the last command may be like: u=rwx,g=rwx,o=rx • This means creating new files with the mode: -rw-rw-r-- And directories with the mode: Drwxrwxr- x Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  4. Umask(User Mask Notes: r:read w:write X:excute u:user g:group o:other • r=4 • w=2 • x=1 Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  5. Umask(User Mask Octal mask: • 666 in the case of files, • 777 in the case of directories. • The octal notation is as follows: • 0 – read, write and execute • 1 – read and write • 2 – read and execute • 3 – read only • 4 – write and execute • 5 – write only • 6 – execute only • 7 – no permissions Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  6. Umask(User Mask (Umask022) • causes files to be created with permissions of 644 (rw-r--r--) , • and directories to be created with permissions of 755 (rwxr-xr-x Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  7. Umask(User Mask • 022 (masking out the write permission for the group and others), which ensures that new files are only writable for the owner (i.e. the user who created them). • Another common value is 002, which leaves the write permission for the file's group enabled. This can be used for files in shared workspaces, where several users work with the same files Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  8. Umask(User Mask umask 0174 mkdir foo touch bar ls -l drw-----wx 2 dave dave 512 Sep 1 20:59 foo -rw----w- 1 dave dave 0 Sep 1 20:59 bar Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  9. chmod (change mode) • (chmod) set permissions (modes) of files or directories Chmod +rwx file-name To add read write and execute for all Chmod -rwx file-name To remove read write and execute from all Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  10. chmod (change mode) • Change mode of MYFILE to -rw-rw-r-- chmod 664 myfile ls -l myfile -rw-rw-r-- 1 57 Jul 3 10:13 myfile Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  11. chmod (change mode) • Add the read and write permissions to the user and group classes of a directory: chmod ug+rw mydir ls -ld mydir drw-rw---- 2 unixguy uguys 96 Dec 8 12:53 mydir Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  12. chmod (change mode) • remove write permissions for all classes: chmod a-w myfile ls -l myfile -r-xr-xr-x 2 unixguy uguys 96 Dec 8 12:53 myfile Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  13. chmod (change mode) • Set the permissions for the user and the group to read and execute only (no write permission) on mydir: chmod ug=rx mydir ls -ld mydir dr-xr-x--- 2 unixguy uguys 96 Dec 8 12:53 mydir Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  14. chgrp(change group) • (chgrp) changes group associated with file. chgrpgroupfiles Or chgrp -R group files . Note: Can be used to change the group associated with subdirectories and files of a directory. Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  15. chgrp(change group) ls -l fu -rw-r--r-- 1 amani amani 545 Nov 04 2004 fu chgrp workfu ls -l fu -rw-r--r-- 1 amani work 545 Nov 04 2004 fu Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  16. chown(change owner) • chown - changes ownership of a file. (chown userid files ) or: • chown -R userid files Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  17. chown(change owner) chown root fu ls –l fu -rwxrwx--- 1 root work 0 Sep 27 19:30 fu Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

  18. End Ustaza. Imtithal Alnour Saeed & Ustaza Sana AL-Hwishel

More Related