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:debian:11:sec:l101 [2025/11/22 09:32] – créée adminelearning:workbooks:debian:11:sec:l101 [2025/12/02 15:12] (Version actuelle) admin
Ligne 9: Ligne 9:
 =====Contenu du Module===== =====Contenu du Module=====
  
-  * **LDF503 - Gestion des Droits**+  * **LDF401 - Gestion des Droits**
     * Contenu du Module     * Contenu du Module
     * Présentation     * Présentation
Ligne 29: Ligne 29:
       * 3.1 - Les ACL       * 3.1 - Les ACL
       * 3.2 - Les Attributs Étendus       * 3.2 - Les Attributs Étendus
 +
  
 =====Présentation===== =====Présentation=====
Ligne 42: Ligne 43:
  
 <code> <code>
-root@debian11:~# exit +trainee@debian12:~$ touch tux.jpg
-logout +
- +
-trainee@debian11:~$ pwd +
-/home/trainee +
- +
-trainee@debian11:~$ touch tux.jpg+
  
-trainee@debian11:~$ ls -l | grep tux.jpg +trainee@debian12:~$ ls -l | grep tux.jpg 
--rw-r--r-- 1 trainee sudo       Jun  5 16:32 tux.jpg+-rw-r--r-- 1 trainee trainee    Nov 25 12:26 tux.jpg
 </code> </code>
  
Ligne 107: Ligne 102:
  
 <code> <code>
-trainee@debian11:~$ chmod o+w tux.jpg+trainee@debian12:~$ chmod o+w tux.jpg
  
-trainee@debian11:~$ ls -l | grep tux.jpg +trainee@debian12:~$ ls -l | grep tux.jpg 
--rw-r--rw- 1 trainee sudo       Jun  5 16:32 tux.jpg+-rw-r--rw- 1 trainee trainee    Nov 25 12:26 tux.jp
 </code> </code>
  
Ligne 116: Ligne 111:
  
 <code> <code>
-trainee@debian11:~$ chmod ug-w tux.jpg+trainee@debian12:~$ chmod ug-w tux.jpg
  
-trainee@debian11:~$ ls -l | grep tux.jpg +trainee@debian12:~$ ls -l | grep tux.jpg 
--r--r--rw- 1 trainee sudo       Jun  5 16:32 tux.jpg+-r--r--rw- 1 trainee trainee    Nov 25 12:26 tux.jpg
 </code> </code>
  
Ligne 143: Ligne 138:
  
 <code> <code>
-trainee@debian11:~$ chmod 644 tux.jpg+trainee@debian12:~$ chmod 644 tux.jpg
  
-trainee@debian11:~$ ls -l | grep tux.jpg +trainee@debian12:~$ ls -l | grep tux.jpg 
--rw-r--r-- 1 trainee sudo       Jun  5 16:32 tux.jpg+-rw-r--r-- 1 trainee trainee    Nov 25 12:26 tux.jpg
 </code> </code>
  
Ligne 158: Ligne 153:
  
 <code> <code>
-trainee@debian11:~$ chmod --help+trainee@debian12:~$ 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 172: Ligne 167:
       --reference=RFILE  use RFILE's mode instead of MODE values       --reference=RFILE  use RFILE's mode instead of MODE values
   -R, --recursive        change files and directories recursively   -R, --recursive        change files and directories recursively
-      --help     display this help and exit +      --help        display this help and exit 
-      --version  output version information and exit+      --version     output version information and exit
  
 Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'. Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=][0-7]+'.
Ligne 189: Ligne 184:
  
 <code> <code>
-trainee@debian11:~$ umask+trainee@debian12:~$ umask
 0022 0022
-trainee@debian11:~$ su - + 
-Password:  +trainee@debian12:~$ su - 
-root@debian11:~# umask+Password: fenestros 
 + 
 +root@debian12:~# umask
 0022 0022
-root@debian11:~# exit+ 
 +root@debian12:~# exit
 logout logout
 </code> </code>
Ligne 215: Ligne 213:
  
 <code> <code>
-trainee@debian11:~$ umask 044+trainee@debian12:~$ umask 044
  
-trainee@debian11:~$ touch tux1.jpg+trainee@debian12:~$ touch tux1.jpg
  
-trainee@debian11:~$ ls -l | grep tux1.jpg +trainee@debian12:~$ ls -l | grep tux1.jpg 
--rw--w--w- 1 trainee sudo       Jun  5 16:38 tux1.jpg+-rw--w--w- 1 trainee trainee    Nov 25 15:01 tux1.jpg
  
-trainee@debian11:~$ umask 022+trainee@debian12:~$ umask 022
  
-trainee@debian11:~$ umask+trainee@debian12:~$ umask
 0022 0022
 </code> </code>
Ligne 231: Ligne 229:
  
 <code> <code>
-trainee@debian11:~$ help umask+trainee@debian12:~$ 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 260: Ligne 258:
  
 <code> <code>
-trainee@debian11:~$ su -+trainee@debian12:~$ su -
 Password: fenestros Password: fenestros
  
-root@debian11:~# cd /home/trainee+root@debian12:~# cd /home/trainee
  
-root@debian11:/home/trainee# chown root tux.jpg+root@debian12:/home/trainee# chown root tux.jpg
  
-root@debian11:/home/trainee# ls -l | grep tux.jpg +root@debian12:/home/trainee# ls -l | grep tux.jpg 
--rw-r--r-- 1 root    sudo       Jun  5 16:32 tux.jpg+-rw-r--r-- 1 root    trainee    Nov 25 12:26 tux.jpg
 </code> </code>
  
Ligne 274: Ligne 272:
  
 <code> <code>
-root@debian11:/home/trainee# chown --help+root@debian12:/home/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 309: Ligne 307:
   -P                     do not traverse any symbolic links (default)   -P                     do not traverse any symbolic links (default)
  
-      --help     display this help and exit +      --help        display this help and exit 
-      --version  output version information and exit+      --version     output version information and exit
  
 Owner is unchanged if missing.  Group is unchanged if missing, but changed Owner is unchanged if missing.  Group is unchanged if missing, but changed
Ligne 331: Ligne 329:
  
 <code> <code>
-root@debian11:/home/trainee# chgrp root tux.jpg+root@debian12:/home/trainee# chgrp root tux.jpg
  
-root@debian11:/home/trainee# ls -l | grep tux.jpg +root@debian12:/home/trainee# ls -l | grep tux.jpg 
--rw-r--r-- 1 root    root       Jun  5 16:32 tux.jpg+-rw-r--r-- 1 root    root       Nov 25 12:26 tux.jpg
 </code> </code>
  
Ligne 344: Ligne 342:
  
 <code> <code>
-root@debian11:/home/trainee# chgrp --help+root@debian12:/home/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 374: Ligne 372:
   -P                     do not traverse any symbolic links (default)   -P                     do not traverse any symbolic links (default)
  
-      --help     display this help and exit +      --help        display this help and exit 
-      --version  output version information and exit+      --version     output version information and exit
  
 Examples: Examples:
Ligne 393: Ligne 391:
  
 <code> <code>
-root@debian11:/home/trainee# ls -l /etc/passwd /usr/bin/passwd +root@debian12:/home/trainee# ls -l /etc/shadow /usr/bin/passwd 
--rw-r--r-- 1 root root  2146 Jun  5 13:01 /etc/passwd +-rw-r----- 1 root shadow  1160 Nov 24 17:28 /etc/shadow 
--rwsr-xr-x 1 root root 63960 Feb  7  2020 /usr/bin/passwd+-rwsr-xr-x 1 root root   68248 Apr  7  2025 /usr/bin/passwd
 </code> </code>
  
Ligne 405: Ligne 403:
 Quand le SUID bit est placé sur un programme, l’utilisateur qui lance ce programme se voit affecté le numéro d’utilisateur du propriétaire de ce programme et ce pour la durée de son exécution. Quand le SUID bit est placé sur un programme, l’utilisateur qui lance ce programme se voit affecté le numéro d’utilisateur du propriétaire de ce programme et ce pour la durée de son exécution.
  
-Dans le cas du changement de mot de passe, chaque utilisateur qui lance le programme /usr/bin/passwd se trouve temporairement avec le numéro d’utilisateur du propriétaire du programme /usr/bin/passwd, c’est à dire root. De cette façon, l’utilisateur peut intervenir sur le fichier /etc/passwd. Ce droit est indiqué par la lettre s à la place de la lettre x.+Dans le cas du changement de mot de passe, chaque utilisateur qui lance le programme /usr/bin/passwd se trouve temporairement avec le numéro d’utilisateur du propriétaire du programme /usr/bin/passwd, c’est à dire root. De cette façon, l’utilisateur peut intervenir sur le fichier /etc/shadow. Ce droit est indiqué par la lettre s à la place de la lettre x.
  
 La même fonction existe pour le groupe à l’aide du SGID bit. La même fonction existe pour le groupe à l’aide du SGID bit.
Ligne 422: Ligne 420:
  
 <code> <code>
-root@debian11:/home/trainee# find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls {} \; +root@debian12:/home/trainee# find / -type f \( -perm -4000 -o -perm -2000 \) -exec ls {} \; 
-find: ‘/proc/27625/task/27625/fdinfo/6’: No such file or directory +find: ‘/proc/1675/task/1675/fdinfo/6’: No such file or directory 
-find: ‘/proc/27625/fdinfo/5’: No such file or directory+find: ‘/proc/1675/fdinfo/5’: No such file or directory
 /usr/bin/su /usr/bin/su
-/usr/bin/fusermount 
 /usr/bin/pkexec /usr/bin/pkexec
 /usr/bin/dotlockfile /usr/bin/dotlockfile
 +/usr/bin/fusermount3
 /usr/bin/expiry /usr/bin/expiry
 /usr/bin/crontab /usr/bin/crontab
Ligne 436: Ligne 434:
 /usr/bin/chage /usr/bin/chage
 /usr/bin/umount /usr/bin/umount
-/usr/bin/mlocate 
 /usr/bin/chfn /usr/bin/chfn
 /usr/bin/passwd /usr/bin/passwd
-/usr/bin/write.ul 
 /usr/bin/gpasswd /usr/bin/gpasswd
 /usr/bin/ssh-agent /usr/bin/ssh-agent
 /usr/bin/newgrp /usr/bin/newgrp
-/usr/bin/wall 
 /usr/bin/ntfs-3g /usr/bin/ntfs-3g
-/usr/libexec/polkit-agent-helper-1 
 /usr/lib/x86_64-linux-gnu/utempter/utempter /usr/lib/x86_64-linux-gnu/utempter/utempter
 +/usr/lib/virtualbox/VBoxNetNAT
 +/usr/lib/virtualbox/VBoxVolInfo
 +/usr/lib/virtualbox/VBoxNetAdpCtl
 +/usr/lib/virtualbox/VirtualBoxVM
 +/usr/lib/virtualbox/VBoxHeadless
 +/usr/lib/virtualbox/VBoxNetDHCP
 +/usr/lib/virtualbox/VBoxSDL
 /usr/lib/dbus-1.0/dbus-daemon-launch-helper /usr/lib/dbus-1.0/dbus-daemon-launch-helper
 /usr/lib/openssh/ssh-keysign /usr/lib/openssh/ssh-keysign
 +/usr/lib/polkit-1/polkit-agent-helper-1
 /usr/lib/xorg/Xorg.wrap /usr/lib/xorg/Xorg.wrap
 /usr/sbin/unix_chkpwd /usr/sbin/unix_chkpwd
Ligne 461: Ligne 463:
  
 <code> <code>
-root@debian11:/home/trainee# cd /tmp+root@debian12:/home/trainee# cd /tmp
  
-root@debian11:/tmp# mkdir inherit+root@debian12:/tmp# mkdir inherit
  
-root@debian11:/tmp# chown root:trainee inherit+root@debian12:/tmp# chown root:trainee inherit
  
-root@debian11:/tmp# chmod g+s inherit+root@debian12:/tmp# chmod g+s inherit
  
-root@debian11:/tmp# touch inherit/test.txt+root@debian12:/tmp# touch inherit/test.txt
  
-root@debian11:/tmp# mkdir inherit/testrep+root@debian12:/tmp# mkdir inherit/testrep
  
-root@debian11:/tmp# cd inherit; ls -l+root@debian12:/tmp# cd inherit; ls -l
 total 4 total 4
-drwxr-sr-x 2 root trainee 4096 Jun  5 17:16 testrep +drwxr-sr-x 2 root trainee 4096 Nov 25 15:09 testrep 
--rw-r--r-- 1 root trainee    0 Jun  5 17:16 test.txt+-rw-r--r-- 1 root trainee    0 Nov 25 15:09 test.txt
 </code>  </code> 
  
Ligne 496: Ligne 498:
  
 <code> <code>
-root@debian11:/tmp/inherit# mkdir /tmp/repertoire_public; cd /tmp; chmod o+t repertoire_public +root@debian12:/tmp/inherit# mkdir /tmp/repertoire_public; cd /tmp; chmod o+t repertoire_public 
-root@debian11:/tmp# ls -l | grep repertoire_public + 
-drwxr-xr-t 2 root    root         4096 Jun  5 17:19 repertoire_public+root@debian12:/tmp# ls -l | grep repertoire_public 
 +drwxr-xr-t 2 root root    4096 Nov 25 15:10 repertoire_public
 </code> </code>
  
Ligne 510: Ligne 513:
  
 <code> <code>
-root@debian11:/tmp# getfacl /home/trainee/tux.jpg+root@debian12:/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 523: Ligne 526:
  
 <code> <code>
-root@debian11:/tmp# setfacl --set u::rwx,g::rx,o::-,u:trainee:rw /home/trainee/tux.jpg+root@debian12:/tmp# setfacl --set u::rwx,g::rx,o::-,u:trainee:rw /home/trainee/tux.jpg
  
-root@debian11:/tmp# getfacl /home/trainee/tux.jpg+root@debian12:/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 544: Ligne 547:
  
 <code> <code>
-root@debian11:/tmp# mkdir /home/trainee/rep1+root@debian12:/tmp# mkdir /home/trainee/rep1
 </code> </code>
  
Ligne 550: Ligne 553:
  
 <code> <code>
-root@debian11:/tmp# setfacl --set d:u::r,d:g::-,d:o::- /home/trainee/rep1+root@debian12:/tmp# setfacl --set d:u::r,d:g::-,d:o::- /home/trainee/rep1
 </code> </code>
  
Ligne 558: Ligne 561:
  
 <code> <code>
-root@debian11:/tmp# touch /home/trainee/rep1/fichier1+root@debian12:/tmp# touch /home/trainee/rep1/fichier1
 </code> </code>
  
Ligne 564: Ligne 567:
  
 <code> <code>
-root@debian11:/tmp# getfacl /home/trainee/rep1+root@debian12:/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 576: Ligne 579:
 default:other::--- default:other::---
  
-root@debian11:/tmp# getfacl /home/trainee/rep1/fichier1+root@debian12:/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 591: Ligne 594:
  
 <code> <code>
-root@debian11:/tmp# cd /home/trainee/rep1+root@debian12:/tmp# cd /home/trainee/rep1
  
-root@debian11:/home/trainee/rep1# getfacl -R --skip-base . > backup.acl+root@debian12:/home/trainee/rep1# getfacl -R --skip-base . > backup.acl
  
-root@debian11:/home/trainee/rep1# cat backup.acl+root@debian12:/home/trainee/rep1# cat backup.acl
 # file: . # file: .
 # owner: root # owner: root
Ligne 614: Ligne 617:
  
 <code> <code>
-root@debian11:/home/trainee/rep1# getfacl --help +root@debian12:/home/trainee/rep1# getfacl --help 
-getfacl 2.2.53 -- get file access control lists+getfacl 2.3.-- get file access control lists
 Usage: getfacl [-aceEsRLPtpndvh] file ... Usage: getfacl [-aceEsRLPtpndvh] file ...
-  -a,  --access           display the file access control list only+  -a, --access            display the file access control list only
   -d, --default           display the default access control list only   -d, --default           display the default access control list only
   -c, --omit-header       do not display the comment header   -c, --omit-header       do not display the comment header
Ligne 628: Ligne 631:
   -t, --tabular           use tabular output format   -t, --tabular           use tabular output format
   -n, --numeric           print numeric user/group identifiers   -n, --numeric           print numeric user/group identifiers
 +      --one-file-system   skip files on different filesystems
   -p, --absolute-names    don't strip leading '/' in pathnames   -p, --absolute-names    don't strip leading '/' in pathnames
   -v, --version           print version and exit   -v, --version           print version and exit
Ligne 636: Ligne 640:
  
 <code> <code>
-root@debian11:/home/trainee/rep1# setfacl --help +root@debian12:/home/trainee/rep1# setfacl --help 
-setfacl 2.2.53 -- set file access control lists+setfacl 2.3.-- set file access control lists
 Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ... Usage: setfacl [-bkndRLP] { -m|-M|-x|-X ... } file ...
   -m, --modify=acl        modify the current ACL(s) of file(s)   -m, --modify=acl        modify the current ACL(s) of file(s)
Ligne 686: Ligne 690:
  
 <code> <code>
-root@debian11:/home/trainee/rep1# cd /root+root@debian12:/home/trainee/rep1# cd /root
  
-root@debian11:~# mkdir -p attributs/rep+root@debian12:~# mkdir -p attributs/rep
 </code> </code>
  
Ligne 694: Ligne 698:
  
 <code> <code>
-root@debian11:~# touch attributs/fichier+root@debian12:~# touch attributs/fichier
  
-root@debian11:~# touch attributs/rep/fichier1+root@debian12:~# touch attributs/rep/fichier1
 </code> </code>
  
Ligne 702: Ligne 706:
  
 <code> <code>
-root@debian11:~# chattr +i -R attributs/+root@debian12:~# chattr +i -R attributs/
 </code> </code>
  
Ligne 708: Ligne 712:
  
 <code> <code>
-root@debian11:~# lsattr -R attributs+root@debian12:~# lsattr -R attributs
 ----i---------e------- attributs/rep ----i---------e------- attributs/rep
  
Ligne 724: Ligne 728:
  
 <code> <code>
-root@debian11:~# cd attributs; mv /root/attributs/fichier /root/attributs/rep/fichier+root@debian12:~# 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>
Menu