1 / 13

Permissions

Permissions. OS515 (Workbook 4). Viewing Permissions. To view permissions from the command line use ls -l . [ student@station student]$ ls -l / var /gigs/ total 28 - rw - rw -r-- 1 elvis elvis 129 Jan 13 14:48 atlanta - rw -r--r-- 1 blondie music 142 Jan 13 14:46 boston

margo
Télécharger la présentation

Permissions

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. Permissions OS515 (Workbook 4)

  2. Viewing Permissions • To view permissions from the command line use ls -l [student@station student]$ ls -l /var/gigs/ total 28 -rw-rw-r-- 1 elviselvis 129 Jan 13 14:48 atlanta -rw-r--r-- 1 blondie music 142 Jan 13 14:46 boston -rw-rw-r-- 1 elvis music 143 Jan 13 14:48 chicago -rwxr-x--- 1 root music 55 Jan 13 15:25 generate_report.sh -rw-rw-r-- 1 root music 2057 Jan 13 14:47 los_angeles -rw-rw-r-- 1 elvis music 142 Jan 13 14:47 san_francisco -rw-rw-r-- 1 blondieblondie 135 Jan 13 14:47 springfield

  3. Permissions [student@station student]$ ls -l /var/gigs/ total 28 -rw-rw-r-- 1 elviselvis 129 Jan 13 14:48 atlanta -rw-r--r-- 1 blondie music 142 Jan 13 14:46 boston

  4. Changing File Permissions: chmod • The chmod command is used to modify file permissions • The first argument to chmod uses a {ugoa}[+-=]{rwx}syntax to describe how the permissions should be changed chmodg+wfilename chmodg-w filename chmodg-w,o+rfilename chmod–R u=rw,g=r,o= directory/

  5. Chgrp and chown • To change the owner of a file use chown chown new-owner file chown –R new-owner directory/ • To change the group of a file use chgrp chgrpnew-group file chgrp–R new-groupdirectory/

  6. Who can chown or chgrp? • Only the root user can use chown • A user can chgrp a file if they are a member of the group they wish to change the file to rpw@ux01:~$ touch secret.plan rpw@ux01:~$ chmod u=rw,g=r,o= secret.plan rpw@ux01:~$ ls -l secret.plan -rw-r----- 1 rpwrpw 0 2010-05-17 17:19 secret.plan rpw@ux01:~$ chgrp admin secret.plan rpw@ux01:~$ ls -l secret.plan -rw-r----- 1 rpw admin 0 2010-05-17 17:19 secret.plan

  7. Who Can Modify File Ownerships and Permissions?

  8. How do directories use permissions?

  9. chmod Revisited: Octal Notation • The chmod command can use an alternate octal syntax • The octal syntax is often quicker and more exacting chmodog-r diary chmodu=rw,g=r,o= diary chmod 600 diary

  10. Where did 600 come from? 755 = rwxr-xr-x(u)ser = rwx= 4 + 2 + 1 = 7(g)roup = r-x = 4 + 0 + 1 = 5(o)ther = r-x = 4 + 0 + 1 = 5640 = rw-r-----(u)ser  = rw- = 4 + 2 + 0 = 6(g)roup=r-- = 4 + 0 + 0 = 4(o)ther=--- = 0 + 0 + 0 = 0701 = rwx-----x(u)ser = rwx = 4 + 2 + 1 = 7(g)roup=--- = 0 + 0 + 0 = 0(o)ther=--x = 0 + 0 + 1 = 1

  11. Controlling default permissions: umask • Linux creates files with a default mode of 666 (rw-rw-rw) • Linux creates directories with a default mode of 777 (rwxrwxrwx) • Every process possesses a "umask" parameter which masks out certain of these default permissions • In Red Hat Enterprise Linux, the default umask for standard users is 002 • The bash shell's umask is modified with the umask command.

  12. file umask examples kernel default: 666 --> rw-rw-rw- umask: 002 --> -------w- default permissions: 664 --> rw-rw-r-- kernel default: 666 --> rw-rw-rw- umask: 077 --> ---rwxrwxdefault permissions: 600 --> rw-------

  13. directory umask examples kernel default: 777 --> rwxrwxrwxumask: 002 --> -------w- default permissions: 775 --> rwxrwxr-x kernel default: 777 --> rwxrwxrwxumask: 077 --> ---rwxrwxdefault permissions: 700 --> rwx------

More Related