====== Différences ======
Cette page vous affiche les différences entre la révision choisie et la version actuelle de la page.
|
cours:activite1:gestion_des_utilisateurs [2013/11/08 10:53] r.doiteau |
cours:activite1:gestion_des_utilisateurs [2019/05/11 14:35] (Version actuelle) |
||
|---|---|---|---|
| Ligne 167: | Ligne 167: | ||
| 8. Compiler le code source précédent avec la commande : | 8. Compiler le code source précédent avec la commande : | ||
| - | gcc droits.c -o droits.exe | + | gcc droits.c -o droits.exe |
| 9. Exécuter successivement le programme droits.exe en tant que root et util1. Quel est le résultat affiché ? Qu'en déduire ? | 9. Exécuter successivement le programme droits.exe en tant que root et util1. Quel est le résultat affiché ? Qu'en déduire ? | ||
| - | <code=c> | + | |
| - | root@debian:/tmp# ./droits.exe | + | root@debian:/tmp# ./droits.exe |
| - | UID réel : 0 | + | UID réel : 0 |
| - | UID effectif : 0 | + | UID effectif : 0 |
| - | GID réel : 0 | + | GID réel : 0 |
| - | GID effectif : 0 | + | GID effectif : 0 |
| - | root@debian:/tmp# su util1 | + | root@debian:/tmp# su util1 |
| - | $ ./droits.exe | + | $ ./droits.exe |
| - | UID réel : 1001 | + | UID réel : 1001 |
| - | UID effectif : 1001 | + | UID effectif : 1001 |
| - | GID réel : 1001 | + | GID réel : 1001 |
| - | GID effectif : 1001 | + | GID effectif : 1001 |
| - | </code> | + | |
| 10. Positionner le droit SUID sur ce fichier et exécuter de nouveau ce programme en tant que root et util1. Quelle est la différence ? | 10. Positionner le droit SUID sur ce fichier et exécuter de nouveau ce programme en tant que root et util1. Quelle est la différence ? | ||
| - | root@debian:/tmp# chmod 4000 droits.exe | + | root@debian:/tmp# chmod 4000 droits.exe |
| - | root@debian:/tmp# ./droits.exe | + | root@debian:/tmp# ./droits.exe |
| - | bash: ./droits.exe: Permission non accordée | + | bash: ./droits.exe: Permission non accordée |
| - | root@debian:/tmp# su util1 | + | root@debian:/tmp# su util1 |
| - | $ bash | + | $ bash |
| - | util1@debian:/tmp$ ./droits.exe | + | util1@debian:/tmp$ ./droits.exe |
| - | bash: ./droits.exe: Permission non accordée | + | bash: ./droits.exe: Permission non accordée |
| Ligne 200: | Ligne 200: | ||
| - | root@debian:/tmp# chown util2 /tmp/droits.exe | + | root@debian:/tmp# chown util2 /tmp/droits.exe |
| - | root@debian:/tmp# chgrp grp2 /tmp/droits.exe | + | root@debian:/tmp# chgrp grp2 /tmp/droits.exe |
| 12. Positionner le droit SGID sur ce fichier et exécuter de nouveau ce programme en tant que root et util1. | 12. Positionner le droit SGID sur ce fichier et exécuter de nouveau ce programme en tant que root et util1. | ||
| - | root@debian:/tmp# chmod 6110 droits.exe | + | root@debian:/tmp# chmod 6110 droits.exe |
| - | root@debian:/tmp# ./droits.exe | + | root@debian:/tmp# ./droits.exe |
| - | UID réel : 0 | + | UID réel : 0 |
| - | UID effectif : 1002 | + | UID effectif : 1002 |
| - | GID réel : 0 | + | GID réel : 0 |
| - | GID effectif : 1002 | + | GID effectif : 1002 |
| - | root@debian:/tmp# ls -ail | + | root@debian:/tmp# ls -ail |
| - | total 68 | + | total 68 |
| - | 783371 drwxrwxrwt 12 root root 4096 nov. 8 09:29 . | + | 783371 drwxrwxrwt 12 root root 4096 nov. 8 09:29 . |
| - | 2 drwxr-xr-x 25 root root 4096 nov. 7 17:01 .. | + | 2 drwxr-xr-x 25 root root 4096 nov. 7 17:01 .. |
| - | 800133 -rw-r--r-- 1 root root 297 nov. 8 09:29 droits.c | + | 800133 -rw-r--r-- 1 root root 297 nov. 8 09:29 droits.c |
| - | 800151 ---s--s--- 1 util2 grp2 7436 nov. 8 09:29 droits.exe | + | 800151 ---s--s--- 1 util2 grp2 7436 nov. 8 09:29 droits.exe |
| - | 798957 drwxrwxrwt 2 root root 4096 nov. 8 09:23 .ICE-unix | + | 798957 drwxrwxrwt 2 root root 4096 nov. 8 09:23 .ICE-unix |
| - | 798962 drwx------ 2 Debian-gdm Debian-gdm 4096 nov. 8 09:23 pulse-BtBEnh3eMTDt | + | 798962 drwx------ 2 Debian-gdm Debian-gdm 4096 nov. 8 09:23 pulse-BtBEnh3eMTDt |
| - | 798973 drwx------ 2 romain romain 4096 nov. 8 09:23 pulse-JtkyoEsgQCKO | + | 798973 drwx------ 2 romain romain 4096 nov. 8 09:23 pulse-JtkyoEsgQCKO |
| - | 798955 drwx------ 2 root root 4096 nov. 8 09:22 pulse-PKdhtXMmr18n | + | 798955 drwx------ 2 root root 4096 nov. 8 09:22 pulse-PKdhtXMmr18n |
| - | 798961 drwx------ 2 romain romain 4096 nov. 8 09:23 ssh-ckU3A6WqzCkd | + | 798961 drwx------ 2 romain romain 4096 nov. 8 09:23 ssh-ckU3A6WqzCkd |
| - | 800126 drwxr-xr-x 2 romain romain 4096 nov. 8 09:23 tracker-romain | + | 800126 drwxr-xr-x 2 romain romain 4096 nov. 8 09:23 tracker-romain |
| - | 783494 drwxrwxrwt 2 root root 4096 nov. 8 09:22 VMwareDnD | + | 783494 drwxrwxrwt 2 root root 4096 nov. 8 09:22 VMwareDnD |
| - | 798974 drwx------ 2 romain romain 4096 nov. 8 09:23 vmware-romain | + | 798974 drwx------ 2 romain romain 4096 nov. 8 09:23 vmware-romain |
| - | 783800 drwx------ 2 root root 4096 nov. 8 09:22 vmware-root | + | 783800 drwx------ 2 root root 4096 nov. 8 09:22 vmware-root |
| - | 798958 -r--r--r-- 1 root root 11 nov. 8 09:22 .X0-lock | + | 798958 -r--r--r-- 1 root root 11 nov. 8 09:22 .X0-lock |
| - | 783808 drwxrwxrwt 2 root root 4096 nov. 8 09:22 .X11-unix | + | 783808 drwxrwxrwt 2 root root 4096 nov. 8 09:22 .X11-unix |
| - | 798966 -rw------- 1 romain romain 11 nov. 8 09:23 xdg-screensaver-romain--0 | + | 798966 -rw------- 1 romain romain 11 nov. 8 09:23 xdg-screensaver-romain--0 |
| - | root@debian:/tmp# su util1 | + | root@debian:/tmp# su util1 |
| - | $ bash | + | $ bash |
| - | util1@debian:/tmp$ ./droits.exe | + | util1@debian:/tmp$ ./droits.exe |
| - | bash: ./droits.exe: Permission non accordée | + | bash: ./droits.exe: Permission non accordée |
| 13. Modifier de nouveau le propriétaire et le groupe du fichier /tmp/droits.exe en root et root. | 13. Modifier de nouveau le propriétaire et le groupe du fichier /tmp/droits.exe en root et root. | ||
| - | root@debian:/tmp# chown root droits.exe | + | root@debian:/tmp# chown root droits.exe |
| - | root@debian:/tmp# chgrp root droits.exe | + | root@debian:/tmp# chgrp root droits.exe |
| + | |||
| 14. Positionner les droits d'accès à 0755 sur le fichier /tmp/droits.exe. | 14. Positionner les droits d'accès à 0755 sur le fichier /tmp/droits.exe. | ||
| - | root@debian:/tmp# chmod 0755 /tmp/droits.exe | + | root@debian:/tmp# chmod 0755 /tmp/droits.exe |
| 15 Ajouter la ligne suivante au fichier /etc/sudoers : | 15 Ajouter la ligne suivante au fichier /etc/sudoers : | ||
| Ligne 254: | Ligne 254: | ||
| successivement en tant que util1 et util2. Est-ce possible ? Si oui, sous quelle identité ? | successivement en tant que util1 et util2. Est-ce possible ? Si oui, sous quelle identité ? | ||
| - | $ sudo /tmp/droits.exe | + | $ sudo /tmp/droits.exe |
| - | [sudo] password for util1: | + | [sudo] password for util1: |
| - | UID réel : 0 | + | UID réel : 0 |
| - | UID effectif : 0 | + | UID effectif : 0 |
| - | GID réel : 0 | + | GID réel : 0 |
| - | GID effectif : 0 | + | GID effectif : 0 |
| Ligne 266: | Ligne 266: | ||
| 1. Mettre en place un répertoire de travail commun pour les membres du grp1 ; tout nouveau fichier créé à l'intérieur de celui-ci devra appartenir à ce groupe. | 1. Mettre en place un répertoire de travail commun pour les membres du grp1 ; tout nouveau fichier créé à l'intérieur de celui-ci devra appartenir à ce groupe. | ||
| - | root@debian:/tmp# chmod 2070 commungrp1/ | + | root@debian:/tmp# chmod 2070 commungrp1/ |