Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Prochaine révision
Révision précédente
elearning:workbooks:redhat:rh124:l107 [2024/09/25 08:01] – created adminelearning:workbooks:redhat:rh124:l107 [2024/11/27 10:14] (Version actuelle) admin
Ligne 1: Ligne 1:
 ~~PDF:LANDSCAPE~~ ~~PDF:LANDSCAPE~~
  
-Version : **2023.01**+Version : **2024.01**
  
 Dernière mise-à-jour : ~~LASTMOD~~ Dernière mise-à-jour : ~~LASTMOD~~
  
-======LCF503 - Gestion des Droits======+======RH12408 - Gestion des Droits======
  
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LCF503 - Gestion des Droits**+  * **RH12408 - Gestion des Droits**
     * Contenu du Module     * Contenu du Module
     * Présentation     * Présentation
Ligne 42: Ligne 42:
  
 <code> <code>
-[root@centos8 ~]# exit+[root@redhat9 ~]# exit
 logout logout
-[trainee@centos8 ~]$ pwd+ 
 +[trainee@redhat9 ~]$ pwd
 /home/trainee /home/trainee
-[trainee@centos8 ~]$ touch tux.jpg + 
-[trainee@centos8 ~]$ ls -l | grep tux.jpg +[trainee@redhat9 ~]$ touch tux.jpg 
--rw-rw-r--. 1 trainee trainee   Apr 21 03:42 tux.jpg+ 
 +[trainee@redhat9 ~]$ ls -l | grep tux.jpg 
 +-rw-r--r--. 1 trainee trainee    Sep 27 12:42 tux.jpg
 </code> </code>
  
Ligne 104: Ligne 107:
  
 <code> <code>
-[trainee@centos8 ~]$ chmod o+w tux.jpg +[trainee@redhat9 ~]$ chmod o+w tux.jpg 
-[trainee@centos8 ~]$ ls -l | grep tux.jpg + 
--rw-rw-rw-. 1 trainee trainee   Apr 21 03:42 tux.jpg+[trainee@redhat9 ~]$ ls -l | grep tux.jpg 
 +-rw-r--rw-. 1 trainee trainee    Sep 27 12:42 tux.jpg
 </code> </code>
  
Ligne 112: Ligne 116:
  
 <code> <code>
-[trainee@centos8 ~]$ chmod ug-w tux.jpg +[trainee@redhat9 ~]$ chmod ug-w tux.jpg 
-[trainee@centos8 ~]$ ls -l | grep tux.jpg + 
--r--r--rw-. 1 trainee trainee   Apr 21 03:42 tux.jpg+[trainee@redhat9 ~]$ ls -l | grep tux.jpg 
 +-r--r--rw-. 1 trainee trainee    Sep 27 12:42 tux.jpg
 </code> </code>
  
Ligne 138: Ligne 143:
  
 <code> <code>
-[trainee@centos8 ~]$ chmod 644 tux.jpg +[trainee@redhat9 ~]$ chmod 644 tux.jpg 
-[trainee@centos8 ~]$ ls -l | grep tux.jpg + 
--rw-r--r--. 1 trainee trainee   Apr 21 03:42 tux.jpg+[trainee@redhat9 ~]$ ls -l | grep tux.jpg 
 +-rw-r--r--. 1 trainee trainee    Sep 27 12:42 tux.jpg
 </code> </code>
  
Ligne 154: Ligne 160:
  
 <code> <code>
-[trainee@centos8 ~]$ chmod --help+[trainee@redhat9 ~]$ chmod --help
 Usage: chmod [OPTION]... MODE[,MODE]... FILE... Usage: chmod [OPTION]... MODE[,MODE]... FILE...
   or:  chmod [OPTION]... OCTAL-MODE FILE...   or:  chmod [OPTION]... OCTAL-MODE FILE...
Ligne 174: Ligne 180:
  
 GNU coreutils online help: <https://www.gnu.org/software/coreutils/> GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
-Full documentation at: <https://www.gnu.org/software/coreutils/chmod>+Full documentation <https://www.gnu.org/software/coreutils/chmod>
 or available locally via: info '(coreutils) chmod invocation' or available locally via: info '(coreutils) chmod invocation'
 </code> </code>
Ligne 180: Ligne 186:
 ===La Commande umask=== ===La Commande umask===
  
-L’utilisateur peut changer sa masque de permissions défaut lors de la création d’objets en utilisant la commande umask.  +L’utilisateur peut changer sa masque de permissions défaut lors de la création d’objets en utilisant la commande umask : 
- +
-La valeur par défaut de l'umask sous RHEL/CentOS est différente pour un utilisateur normal et pour root :+
  
 <code> <code>
-[trainee@centos8 ~]$ umask +[trainee@redhat9 ~]$ umask 
-0002 +0022 
-[trainee@centos8 ~]$ su -+[trainee@redhat9 ~]$ su -
 Password: fenestros Password: fenestros
-[root@centos8 ~]# umask+[root@redhat9 ~]# umask
 0022 0022
-[root@centos8 ~]# exit+[root@redhat9 ~]# exit
 logout logout
 +[trainee@redhat9 ~]$
 </code> </code>
  
-Par exemple dans le cas où l’utilisateur souhaite que les fichiers créés dans le futur comportent des droits d’écriture et de lecture pour l’utilisateur mais uniquement des droits de lecture pour le groupe et pour les autres, il utiliserait la commande :+Par exemple dans le cas où l’utilisateur souhaite que les fichiers créés dans le futur comportent des droits d’écriture et de lecture pour l’utilisateur et le groupe mais uniquement des droits de lecture pour les autres, il utiliserait la commande :
  
-  $ umask 022 [Entrée]+  $ umask 002 [Entrée]
  
 avant de créer son fichier.  avant de créer son fichier. 
Ligne 204: Ligne 209:
 umask sert à enlever des droits des droits maximaux : umask sert à enlever des droits des droits maximaux :
 ^ Masque maximum lors de la création d’un fichier | rw- rw- rw- | 666 | ^ Masque maximum lors de la création d’un fichier | rw- rw- rw- | 666 |
-^ Droits à retirer | --- -w- -w- | 022 +^ Droits à retirer | --- --- -w- | 002 
-^ Résultat | rw-  r--  r-- | 644 |+^ Résultat | rw-  rw-  r-- | 664 |
 </WRAP> </WRAP>
  
Ligne 211: Ligne 216:
  
 <code> <code>
-[trainee@centos8 ~]$ umask 044 +[trainee@redhat9 ~]$ umask 044 
-[trainee@centos8 ~]$ touch tux1.jpg + 
-[trainee@centos8 ~]$ ls -l | grep tux1.jpg +[trainee@redhat9 ~]$ touch tux1.jpg 
--rw--w--w-. 1 trainee trainee   Apr 21 04:06 tux1.jpg + 
-[trainee@centos8 ~]$ umask 002 +[trainee@redhat9 ~]$ ls -l | grep tux1.jpg 
-[trainee@centos8 ~]$ umask +-rw--w--w-. 1 trainee trainee    Sep 27 12:48 tux1.jpg 
-0002+ 
 +[trainee@redhat9 ~]$ umask 022 
 + 
 +[trainee@redhat9 ~]$ umask 
 +0022
 </code> </code>
  
Ligne 225: Ligne 234:
  
 <code> <code>
-[trainee@centos8 ~]$ help umask+[trainee@redhat9 ~]$ help umask
 umask: umask [-p] [-S] [mode] umask: umask [-p] [-S] [mode]
     Display or set file mode mask.     Display or set file mode mask.
Ligne 236: Ligne 245:
          
     Options:     Options:
-      -p if MODE is omitted, output in a form that may be reused as input +      -p        if MODE is omitted, output in a form that may be reused as input 
-      -S makes the output symbolic; otherwise an octal number is output+      -S        makes the output symbolic; otherwise an octal number is output
          
     Exit Status:     Exit Status:
Ligne 254: Ligne 263:
  
 <code> <code>
-[trainee@centos8 ~]$ su -+[trainee@redhat9 ~]$ su -
 Password: fenestros Password: fenestros
-[root@centos8 ~]# cd /home/trainee + 
-[root@centos8 trainee]# chown root tux.jpg +[root@redhat9 ~]# cd /home/trainee 
-[root@centos8 trainee]# ls -l | grep tux.jpg + 
--rw-r--r--. 1 root    trainee   Apr 21 03:42 tux.jpg+[root@redhat9 trainee]# chown root tux.jpg  
 + 
 +[root@redhat9 trainee]# ls -l | grep tux.jpg 
 +-rw-r--r--. 1 root    trainee    Sep 27 12:42 tux.jpg
 </code> </code>
  
Ligne 267: Ligne 279:
  
 <code> <code>
-[root@centos8 trainee]# chown --help+[root@redhat9 trainee]# chown --help
 Usage: chown [OPTION]... [OWNER][:[GROUP]] FILE... Usage: chown [OPTION]... [OWNER][:[GROUP]] FILE...
   or:  chown [OPTION]... --reference=RFILE FILE...   or:  chown [OPTION]... --reference=RFILE FILE...
Ligne 315: Ligne 327:
  
 GNU coreutils online help: <https://www.gnu.org/software/coreutils/> GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
-Full documentation at: <https://www.gnu.org/software/coreutils/chown>+Full documentation <https://www.gnu.org/software/coreutils/chown>
 or available locally via: info '(coreutils) chown invocation' or available locally via: info '(coreutils) chown invocation'
 </code> </code>
Ligne 324: Ligne 336:
  
 <code> <code>
-[root@centos8 trainee]# chgrp root tux.jpg +[root@redhat9 trainee]# chgrp root tux.jpg 
-[root@centos8 trainee]# ls -l | grep tux.jpg + 
--rw-r--r--. 1 root    root      Apr 21 03:42 tux.jpg+[root@redhat9 trainee]# ls -l | grep tux.jpg 
 +-rw-r--r--. 1 root    root       Sep 27 12:42 tux.jpg
 </code> </code>
  
Ligne 338: Ligne 351:
  
 <code> <code>
-[root@centos8 trainee]# chgrp --help+[root@redhat9 trainee]# chgrp --help
 Usage: chgrp [OPTION]... GROUP FILE... Usage: chgrp [OPTION]... GROUP FILE...
   or:  chgrp [OPTION]... --reference=RFILE FILE...   or:  chgrp [OPTION]... --reference=RFILE FILE...
Ligne 376: Ligne 389:
  
 GNU coreutils online help: <https://www.gnu.org/software/coreutils/> GNU coreutils online help: <https://www.gnu.org/software/coreutils/>
-Full documentation at: <https://www.gnu.org/software/coreutils/chgrp>+Full documentation <https://www.gnu.org/software/coreutils/chgrp>
 or available locally via: info '(coreutils) chgrp invocation' or available locally via: info '(coreutils) chgrp invocation'
 </code> </code>
Ligne 387: Ligne 400:
  
 <code> <code>
-[root@centos8 trainee]# ls -l /etc/passwd /usr/bin/passwd +[root@redhat9 trainee]# ls -l /etc/passwd /usr/bin/passwd 
--rw-r--r--. 1 root root  2104 Apr 20 18:36 /etc/passwd +-rw-r--r--. 1 root root  2162 Sep 26 14:57 /etc/passwd 
--rwsr-xr-x. 1 root root 33600 Apr  6  2020 /usr/bin/passwd+-rwsr-xr-x. 1 root root 32648 Aug 10  2021 /usr/bin/passwd
 </code> </code>
  
Ligne 416: Ligne 429:
  
 <code> <code>
-[root@centos8 trainee]# find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls {} \; +[root@redhat9 trainee]# find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls {} \; 
-find: ‘/proc/17916/task/17916/fdinfo/5’: No such file or directory +find: ‘/proc/9995/task/9995/fdinfo/6’: No such file or directory 
-find: ‘/proc/17916/fdinfo/6’: No such file or directory+find: ‘/proc/9995/fdinfo/5’: No such file or directory 
 +/usr/bin/fusermount3
 /usr/bin/chage /usr/bin/chage
 /usr/bin/gpasswd /usr/bin/gpasswd
 /usr/bin/newgrp /usr/bin/newgrp
 +/usr/bin/fusermount
 /usr/bin/mount /usr/bin/mount
-/usr/bin/su 
 /usr/bin/umount /usr/bin/umount
 +/usr/bin/su
 /usr/bin/write /usr/bin/write
 /usr/bin/pkexec /usr/bin/pkexec
-/usr/bin/chfn 
 /usr/bin/crontab /usr/bin/crontab
-/usr/bin/chsh +/usr/bin/passwd
-/usr/bin/at+
 /usr/bin/sudo /usr/bin/sudo
 /usr/bin/locate /usr/bin/locate
-/usr/bin/passwd +/usr/bin/chsh 
-/usr/bin/fusermount+/usr/bin/vmware-user-suid-wrapper 
 +/usr/bin/at 
 +/usr/bin/chfn
 /usr/bin/screen /usr/bin/screen
 /usr/sbin/grub2-set-bootflag /usr/sbin/grub2-set-bootflag
-/usr/sbin/unix_chkpwd 
 /usr/sbin/pam_timestamp_check /usr/sbin/pam_timestamp_check
-/usr/sbin/mount.nfs+/usr/sbin/unix_chkpwd 
 +/usr/sbin/userhelper 
 +/usr/sbin/lockdev
 /usr/lib/polkit-1/polkit-agent-helper-1 /usr/lib/polkit-1/polkit-agent-helper-1
-/usr/libexec/dbus-1/dbus-daemon-launch-helper 
 /usr/libexec/utempter/utempter /usr/libexec/utempter/utempter
 /usr/libexec/openssh/ssh-keysign /usr/libexec/openssh/ssh-keysign
-/usr/libexec/cockpit-session+/usr/libexec/dbus-1/dbus-daemon-launch-helper
 /usr/libexec/sssd/krb5_child /usr/libexec/sssd/krb5_child
 /usr/libexec/sssd/ldap_child /usr/libexec/sssd/ldap_child
-/usr/libexec/sssd/selinux_child 
 /usr/libexec/sssd/proxy_child /usr/libexec/sssd/proxy_child
-/usr/libexec/qemu-bridge-helper +/usr/libexec/sssd/selinux_child 
-/usr/libexec/spice-gtk-x86_64/spice-client-glib-usb-acl-helper+/usr/libexec/Xorg.wrap 
 +/usr/libexec/cockpit-session
 </code> </code>
  
Ligne 460: Ligne 475:
  
 <code> <code>
-[root@centos8 trainee]# cd /tmp +[root@redhat9 trainee]# cd /tmp 
-[root@centos8 tmp]# mkdir inherit + 
-[root@centos8 tmp]# chown root:trainee inherit +[root@redhat9 tmp]# mkdir inherit 
-[root@centos8 tmp]# chmod g+s inherit + 
-[root@centos8 tmp]# touch inherit/test.txt +[root@redhat9 tmp]# chown root:trainee inherit 
-[root@centos8 tmp]# mkdir inherit/testrep + 
-[root@centos8 tmp]# cd inherit; ls -l+[root@redhat9 tmp]# chmod g+s inherit 
 + 
 +[root@redhat9 tmp]# touch inherit/test.txt 
 + 
 +[root@redhat9 tmp]# mkdir inherit/testrep 
 + 
 +[root@redhat9 tmp]# cd inherit; ls -l
 total 0 total 0
-drwxr-sr-x. 2 root trainee 6 Apr 21 04:50 testrep +drwxr-sr-x. 2 root trainee 6 Sep 27 12:55 testrep 
--rw-r--r--. 1 root trainee 0 Apr 21 04:50 test.txt+-rw-r--r--. 1 root trainee 0 Sep 27 12:54 test.txt 
 + 
 +[root@redhat9 inherit]# 
 </code>  </code> 
  
Ligne 489: Ligne 512:
  
 <code> <code>
-[root@centos8 inherit]# mkdir /tmp/repertoire_public; cd /tmp; chmod o+t repertoire_public +[root@redhat9 inherit]# mkdir /tmp/repertoire_public; cd /tmp; chmod o+t repertoire_public 
-[root@centos8 tmp]# ls -l | grep repertoire_public + 
-drwxr-xr-t. 2 root root            6 Apr 21 04:53 repertoire_public+[root@redhat9 tmp]# ls -l | grep repertoire_public 
 +drwxr-xr-t. 2 root root            6 Sep 27 12:56 repertoire_public
 </code> </code>
  
Ligne 503: Ligne 527:
  
 <code> <code>
-[root@centos8 tmp]# getfacl /home/trainee/tux.jpg+[root@redhat9 tmp]# getfacl /home/trainee/tux.jpg
 getfacl: Removing leading '/' from absolute path names getfacl: Removing leading '/' from absolute path names
 # file: home/trainee/tux.jpg # file: home/trainee/tux.jpg
Ligne 516: Ligne 540:
  
 <code> <code>
-[root@centos8 tmp]# setfacl --set u::rwx,g::rx,o::-,u:trainee:rw /home/trainee/tux.jpg +[root@redhat9 tmp]# setfacl --set u::rwx,g::rx,o::-,u:trainee:rw /home/trainee/tux.jpg 
-[root@centos8 tmp]# getfacl /home/trainee/tux.jpg+[root@redhat9 tmp]# getfacl /home/trainee/tux.jpg
 getfacl: Removing leading '/' from absolute path names getfacl: Removing leading '/' from absolute path names
 # file: home/trainee/tux.jpg # file: home/trainee/tux.jpg
Ligne 536: Ligne 560:
  
 <code> <code>
-[root@centos8 tmp]# mkdir /home/trainee/rep1+[root@redhat9 tmp]# mkdir /home/trainee/rep1
 </code> </code>
  
Ligne 542: Ligne 566:
  
 <code> <code>
-[root@centos8 tmp]# setfacl --set d:u::r,d:g::-,d:o::- /home/trainee/rep1+[root@redhat9 tmp]# setfacl --set d:u::r,d:g::-,d:o::- /home/trainee/rep1
 </code> </code>
  
Ligne 550: Ligne 574:
  
 <code> <code>
-[root@centos8 tmp]# touch /home/trainee/rep1/fichier1+[root@redhat9 tmp]# touch /home/trainee/rep1/fichier1
 </code> </code>
  
Ligne 556: Ligne 580:
  
 <code> <code>
-[root@centos8 tmp]# getfacl /home/trainee/rep1+[root@redhat9 tmp]# getfacl /home/trainee/rep1
 getfacl: Removing leading '/' from absolute path names getfacl: Removing leading '/' from absolute path names
 # file: home/trainee/rep1 # file: home/trainee/rep1
Ligne 568: Ligne 592:
 default:other::--- default:other::---
  
-[root@centos8 tmp]# getfacl /home/trainee/rep1/fichier1+[root@redhat9 tmp]# getfacl /home/trainee/rep1/fichier1
 getfacl: Removing leading '/' from absolute path names getfacl: Removing leading '/' from absolute path names
 # file: home/trainee/rep1/fichier1 # file: home/trainee/rep1/fichier1
Ligne 583: Ligne 607:
  
 <code> <code>
-[root@centos8 tmp]# cd /home/trainee/rep1 +[root@redhat9 tmp]# cd /home/trainee/rep1 
-[root@centos8 rep1]# getfacl -R --skip-base . > backup.acl +[root@redhat9 rep1]# getfacl -R --skip-base . > backup.acl 
-[root@centos8 rep1]# cat backup.acl +[root@redhat9 rep1]# cat backup.acl 
 # file: . # file: .
 # owner: root # owner: root
Ligne 606: Ligne 630:
  
 <code> <code>
-[root@centos8 tmp]# getfacl --help+[root@redhat9 tmp]# getfacl --help
 getfacl 2.2.53 -- get file access control lists getfacl 2.2.53 -- get file access control lists
 Usage: getfacl [-aceEsRLPtpndvh] file ... Usage: getfacl [-aceEsRLPtpndvh] file ...
Ligne 628: Ligne 652:
  
 <code> <code>
-[root@centos8 tmp]# setfacl --help+[root@redhat9 tmp]# setfacl --help
 setfacl 2.2.53 -- set file access control lists setfacl 2.2.53 -- set file access control lists
 Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
Ligne 678: Ligne 702:
  
 <code> <code>
-[root@centos8 rep1]# cd /root +[root@redhat9 rep1]# cd /root 
-[root@centos8 ~]# mkdir -p attributs/rep+[root@redhat9 ~]# mkdir -p attributs/rep
 </code> </code>
  
Ligne 685: Ligne 709:
  
 <code> <code>
-[root@centos8 ~]# touch attributs/fichier +[root@redhat9 ~]# touch attributs/fichier 
-[root@centos8 ~]# touch attributs/rep/fichier1+[root@redhat9 ~]# touch attributs/rep/fichier1
 </code> </code>
  
Ligne 692: Ligne 716:
  
 <code> <code>
-[root@centos8 ~]# chattr +i -R attributs/+[root@redhat9 ~]# chattr +i -R attributs/
 </code> </code>
  
Ligne 698: Ligne 722:
  
 <code> <code>
-[root@centos8 ~]# lsattr -R attributs+[root@redhat9 ~]# lsattr -R attributs
 ----i----------- attributs/rep ----i----------- attributs/rep
  
Ligne 706: Ligne 730:
 ----i----------- attributs/fichier ----i----------- attributs/fichier
 </code> </code>
- 
-<WRAP center round important 60%> 
-**Important** - Notez que l'attribut **e** sous Ext4 indique l'utilisation des **Extents**. Cet attribut ne peut pas être enlever avec la commande **chattr**. Les Extents seront couverts dans le cours **Gestion des Disques, des Systèmes de Fichiers et le Swap**. 
-</WRAP> 
  
 Essayez maintenant de déplacer le fichier **fichier**. Vous obtiendrez un résultat similaire à celui-ci : Essayez maintenant de déplacer le fichier **fichier**. Vous obtiendrez un résultat similaire à celui-ci :
  
 <code> <code>
-[root@centos8 ~]# cd attributs; mv /root/attributs/fichier /root/attributs/rep/fichier+[root@redhat9 ~]# cd attributs; mv /root/attributs/fichier /root/attributs/rep/fichier
 mv: cannot move '/root/attributs/fichier' to '/root/attributs/rep/fichier': Operation not permitted mv: cannot move '/root/attributs/fichier' to '/root/attributs/rep/fichier': Operation not permitted
 </code> </code>
  
 ----- -----
-Copyright © 2023 Hugh Norris.+Copyright © 2024 Hugh Norris.
Menu