Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
elearning:workbooks:debian:10:junior:l106 [2022/05/17 08:14] – admin | elearning:workbooks:debian:10:junior:l106 [2024/03/08 08:28] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version : **2022.01** | + | Version : **2024.01** |
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
- | ======LCF501 | + | ======LDF501 |
=====Contenu du Module===== | =====Contenu du Module===== | ||
- | * **LCF501 | + | * **LDF501 |
* Contenu du Module | * Contenu du Module | ||
* Présentation | * Présentation | ||
Ligne 32: | Ligne 32: | ||
* LAB #1 - Gérer les Utilisateurs et les Groupes | * LAB #1 - Gérer les Utilisateurs et les Groupes | ||
* LAB #2 - Forcer l' | * LAB #2 - Forcer l' | ||
- | * Utiliser des Mots de Passe Complexe | + | * 2.1 - Présentation de PAM |
- | * Configuration | + | * 2.2 - Configuration des modules |
- | * su et su - | + | * 2.3 - Utiliser des Mots de Passe Complexe |
- | * sudo | + | * LAB #3 - su et su - |
+ | * LAB #4 - sudo | ||
=====Présentation===== | =====Présentation===== | ||
- | <WRAP center round todo 60%> | + | <WRAP center round todo> |
**A faire** : Afin de mettre en pratique les exemples dans ce cours, vous devez vous connecter à votre système en tant que root grâce à la commande **su -** et le mot de passe **fenestros**. | **A faire** : Afin de mettre en pratique les exemples dans ce cours, vous devez vous connecter à votre système en tant que root grâce à la commande **su -** et le mot de passe **fenestros**. | ||
</ | </ | ||
Ligne 53: | Ligne 54: | ||
* **/ | * **/ | ||
- | ====/ | + | ====/ |
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | # Generated by authselect on Mon Apr 19 11:54:28 2021 | + | # / |
- | # Do not modify this file manually. | + | |
- | + | ||
- | # If you want to make changes to nsswitch.conf please modify | + | |
- | # /etc/authselect/ | + | |
# | # | ||
- | # Note that your changes may not be applied as they may be | + | # Example configuration of GNU Name Service Switch functionality. |
- | # overwritten by selected profile. Maps set in the authselect | + | # If you have the `glibc-doc-reference' |
- | # profile takes always precedence | + | # `info libc "Name Service Switch"' |
- | # set in the user file. Only maps that are not set by the profile | + | |
- | # are applied from the user file. | + | |
- | # | + | |
- | # For example, if the profile sets: | + | |
- | # passwd: sss files | + | |
- | # and / | + | |
- | # | + | |
- | # | + | |
- | # the resulting generated nsswitch.conf will be: | + | |
- | # | + | |
- | # | + | |
- | passwd: | + | passwd: |
- | group: | + | group: |
- | netgroup: sss files | + | shadow: |
- | automount: | + | gshadow: |
- | services: | + | |
- | ... | + | hosts: |
- | shadow: | + | networks: |
- | ... | + | |
+ | protocols: | ||
+ | services: | ||
+ | ethers: | ||
+ | rpc: | ||
+ | |||
+ | netgroup: | ||
</ | </ | ||
- | Dans ce fichier | + | Pour les entrées **passwd**, **group**, **shadow** et **gshadow** : |
+ | |||
+ | * **files** implique l' | ||
+ | * **systemd** implique l' | ||
+ | |||
+ | Il est aussi possible de trouver une autre valeur pour ces entrées | ||
* **sss** implique l' | * **sss** implique l' | ||
* SSSD trouve ses origines dans le projet opensource **FreeIPA** (Identity, Policy and Audit) et offre aux réseaux Linux/Unix des fonctionalités similaires à celles fournies aux réseaux Windows(tm) par les Microsoft Active Directory Domain Services, | * SSSD trouve ses origines dans le projet opensource **FreeIPA** (Identity, Policy and Audit) et offre aux réseaux Linux/Unix des fonctionalités similaires à celles fournies aux réseaux Windows(tm) par les Microsoft Active Directory Domain Services, | ||
* Pour plus d' | * Pour plus d' | ||
- | * **files** implique l' | ||
- | * **systemd** implique l' | ||
====Interrogation des Bases de Données==== | ====Interrogation des Bases de Données==== | ||
Ligne 105: | Ligne 100: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# getent passwd trainee |
- | trainee: | + | trainee: |
</ | </ | ||
Ligne 112: | Ligne 107: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# getent group mail |
- | mail:x:12: | + | mail:x:8: |
</ | </ | ||
Ligne 119: | Ligne 114: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# getent passwd |
root: | root: | ||
- | bin:x:1:1:bin:/bin:/ | + | daemon:x:1:1:daemon:/usr/sbin:/usr/ |
- | daemon:x:2:2:daemon:/sbin:/ | + | bin:x:2:2:bin:/bin:/usr/ |
- | adm:x:3:4:adm:/var/adm:/ | + | sys:x:3:3:sys:/dev:/usr/ |
- | lp:x:4:7:lp:/var/ | + | sync:x:4:65534:sync:/bin:/bin/sync |
- | sync:x:5:0:sync:/sbin:/bin/sync | + | games:x:5:60:games:/usr/games:/usr/sbin/ |
- | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown | + | man:x:6:12:man:/var/ |
- | halt:x:7:0:halt:/sbin:/sbin/halt | + | lp:x:7:7:lp:/var/ |
- | mail:x:8:12:mail:/var/spool/ | + | mail:x:8:8: |
- | operator:x:11:0:operator:/root:/sbin/nologin | + | news:x:9:9:news:/var/spool/news:/ |
- | games: | + | uucp:x:10:10:uucp:/var/spool/uucp:/usr/ |
- | ftp:x:14:50:FTP User:/var/ftp:/ | + | proxy:x:13:13:proxy:/bin:/usr/ |
- | nobody:x:65534:65534:Kernel Overflow User:/:/ | + | www-data:x:33:33:www-data:/var/www:/usr/ |
- | dbus:x:81:81:System message bus:/:/ | + | backup:x:34:34:backup:/var/backups:/usr/ |
- | systemd-coredump:x:999:997:systemd Core Dumper:/:/ | + | list:x:38:38:Mailing List Manager:/var/list:/usr/ |
- | systemd-resolve:x:193:193:systemd Resolver:/:/ | + | irc:x:39:39:ircd:/run/ircd:/usr/ |
- | tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/ | + | gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/ |
- | polkitd:x:998:996:User for polkitd:/:/ | + | nobody:x:65534:65534:nobody:/nonexistent:/usr/ |
- | unbound:x:997:994:Unbound DNS resolver:/etc/unbound:/ | + | _apt:x:100:65534::/nonexistent:/usr/ |
- | libstoragemgmt:x:996:993:daemon account for libstoragemgmt:/var/run/lsm:/ | + | systemd-network:x:101:102:systemd Network Management,,, |
- | cockpit-ws:x:995:991:User for cockpit-ws:/nonexisting:/ | + | systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/ |
- | sssd:x:994:990:User for sssd:/:/ | + | messagebus:x:103:109::/nonexistent:/usr/ |
- | setroubleshoot:x:993:989::/var/ | + | systemd-timesync:x:104:110:systemd Time Synchronization,,, |
- | sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/ | + | usbmux:x:105:46:usbmux daemon,,,:/var/lib/usbmux:/usr/ |
- | chrony:x:992:988::/var/lib/chrony:/ | + | rtkit:x:106:113:RealtimeKit,,, |
- | tcpdump:x:72:72::/:/ | + | dnsmasq:x:107:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/ |
- | trainee:x:1000:1000:trainee:/home/trainee:/bin/bash | + | avahi:x:108:114:Avahi mDNS daemon,,,:/run/ |
- | cockpit-wsinstance:x:991:987:User for cockpit-ws instances:/nonexisting:/ | + | speech-dispatcher:x:109:29:Speech Dispatcher,,, |
- | rngd:x:990:986:Random Number Generator Daemon:/var/lib/rngd:/sbin/nologin | + | pulse:x:110:116:PulseAudio daemon,,,:/run/pulse:/usr/ |
- | gluster:x:989:985:GlusterFS daemons:/run/gluster:/ | + | saned:x:111:119::/var/ |
- | qemu:x:107:107:qemu user:/:/ | + | colord:x:112:120:colord colour management daemon,,,:/var/lib/colord:/usr/ |
- | rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/ | + | lightdm:x:113:121:Light Display Manager:/var/lib/lightdm:/bin/false |
- | rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin | + | trainee:x:1000:1000:trainee,,,:/home/trainee:/bin/bash |
- | saslauth:x:988:76:Saslauthd user:/run/saslauthd:/sbin/nologin | + | systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/ |
- | radvd:x:75:75:radvd user:/:/ | + | sshd:x:114:65534::/run/sshd:/usr/ |
- | dnsmasq:x:983:983:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/ | + | |
</ | </ | ||
Ligne 163: | Ligne 157: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat /etc/group |
root:x:0: | root:x:0: | ||
- | bin:x:1: | + | daemon:x:1: |
- | daemon:x:2: | + | bin:x:2: |
sys:x:3: | sys:x:3: | ||
adm:x:4: | adm:x:4: | ||
Ligne 172: | Ligne 166: | ||
disk:x:6: | disk:x:6: | ||
lp:x:7: | lp:x:7: | ||
- | mem:x:8: | + | mail:x:8: |
- | kmem:x:9: | + | news:x:9: |
- | wheel:x:10: | + | uucp:x:10: |
- | cdrom:x:11: | + | man:x:12: |
- | mail:x:12: | + | proxy:x:13: |
- | man:x:15: | + | kmem:x:15: |
- | dialout:x:18: | + | dialout:x:20: |
- | floppy:x:19: | + | fax:x:21: |
- | games:x:20: | + | voice:x:22: |
- | tape: | + | cdrom: |
- | video:x:39: | + | floppy: |
- | ftp:x:50: | + | tape:x:26: |
- | lock:x:54: | + | sudo: |
- | audio:x:63: | + | audio: |
+ | dip: | ||
+ | www-data:x:33: | ||
+ | backup: | ||
+ | operator: | ||
+ | list: | ||
+ | irc:x:39: | ||
+ | src:x:40: | ||
+ | gnats:x:41: | ||
+ | shadow: | ||
+ | utmp: | ||
+ | video: | ||
+ | sasl: | ||
+ | plugdev: | ||
+ | staff: | ||
+ | games:x:60: | ||
users: | users: | ||
- | nobody:x:65534: | + | nogroup:x:65534: |
- | dbus:x:81: | + | systemd-journal:x:101: |
- | utmp:x:22: | + | systemd-network:x:102: |
- | utempter:x:35: | + | systemd-resolve:x:103: |
- | input:x:999: | + | input:x:104: |
- | kvm:x:36:qemu | + | kvm:x:105: |
- | render:x:998: | + | render:x:106: |
- | systemd-journal:x:190: | + | crontab:x:107: |
- | systemd-coredump:x:997: | + | netdev:x:108:trainee |
- | systemd-resolve:x:193: | + | messagebus:x:109: |
- | tss:x:59: | + | systemd-timesync:x:110: |
- | polkitd:x:996: | + | ssh:x:111: |
- | printadmin:x:995: | + | ssl-cert:x:112: |
- | unbound:x:994: | + | rtkit:x:113: |
- | libstoragemgmt:x:993: | + | avahi:x:114: |
- | ssh_keys:x:992: | + | lpadmin:x:115:trainee |
- | cockpit-ws:x:991: | + | pulse:x:116: |
- | sssd: | + | pulse-access:x:117: |
- | setroubleshoot:x:989: | + | scanner:x:118:saned, |
- | sshd:x:74: | + | saned:x:119: |
- | chrony:x:988: | + | colord:x:120: |
- | slocate:x:21: | + | lightdm:x:121: |
- | tcpdump:x:72: | + | |
trainee: | trainee: | ||
- | cockpit-wsinstance:x:987: | + | systemd-coredump:x:999: |
- | rngd:x:986: | + | mlocate:x:122: |
- | gluster: | + | |
- | qemu: | + | |
- | rpc:x:32: | + | |
- | rpcuser: | + | |
- | saslauth: | + | |
- | libvirt: | + | |
- | radvd: | + | |
- | dnsmasq: | + | |
- | screen:x:84: | + | |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Notez que la valeur du GID du groupe root est toujours de 0. Notez que sous RHEL / CentOS 8, les GID des utilisateurs normaux commencent à **1000** et les GID des comptes système sont inclus entre 1 et 99 et entre 201 et 999. | + | **Important** : Notez que la valeur du GID du groupe root est toujours de 0. Notez que sous Debian 11, les GID des utilisateurs normaux commencent à **1000** et les GID des comptes système sont inclus entre 1 et 99 et entre 201 et 999. |
</ | </ | ||
Ligne 238: | Ligne 237: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | root::: | + | root:*:: |
- | bin::: | + | daemon:*:: |
- | daemon::: | + | bin:*:: |
- | sys::: | + | sys:*:: |
- | adm::: | + | adm:*:: |
- | tty::: | + | tty:*:: |
- | disk::: | + | disk:*:: |
- | lp::: | + | lp:*:: |
- | mem::: | + | mail:*:: |
- | kmem::: | + | news:*:: |
- | wheel::: | + | uucp:*:: |
- | cdrom::: | + | man:*:: |
- | mail::: | + | proxy:*:: |
- | man::: | + | kmem:*:: |
- | dialout::: | + | dialout:*:: |
- | floppy::: | + | fax:*:: |
- | games::: | + | voice:*:: |
- | tape::: | + | cdrom:*::trainee |
- | video::: | + | floppy:*::trainee |
- | ftp::: | + | tape:*:: |
- | lock::: | + | sudo:*:: |
- | audio::: | + | audio:*::pulse, |
- | users::: | + | dip:*::trainee |
- | nobody::: | + | www-data:*:: |
- | dbus:!:: | + | backup:*:: |
- | utmp:!:: | + | operator: |
- | utempter:!:: | + | list:*:: |
- | input:!:: | + | irc:*:: |
- | kvm:!::qemu | + | src:*:: |
- | render:!:: | + | gnats:*:: |
+ | shadow:*:: | ||
+ | utmp:*:: | ||
+ | video:*::trainee | ||
+ | sasl:*:: | ||
+ | plugdev: | ||
+ | staff:*:: | ||
+ | games:*:: | ||
+ | users:*:: | ||
+ | nogroup:*:: | ||
systemd-journal: | systemd-journal: | ||
- | systemd-coredump:!:: | + | systemd-network:!:: |
systemd-resolve: | systemd-resolve: | ||
- | tss:!:: | + | input:!:: |
- | polkitd:!:: | + | kvm:!:: |
- | printadmin:!:: | + | render:!:: |
- | unbound:!:: | + | crontab:!:: |
- | libstoragemgmt:!:: | + | netdev:!::trainee |
- | ssh_keys:!:: | + | messagebus:!:: |
- | cockpit-ws:!:: | + | systemd-timesync:!:: |
- | sssd:!:: | + | ssh:!:: |
- | setroubleshoot:!:: | + | ssl-cert: |
- | sshd:!:: | + | rtkit:!:: |
- | chrony:!:: | + | avahi:!:: |
- | slocate:!:: | + | lpadmin: |
- | tcpdump:!:: | + | pulse:!:: |
+ | pulse-access:!:: | ||
+ | scanner:!::saned, | ||
+ | saned:!:: | ||
+ | colord:!:: | ||
+ | lightdm:!:: | ||
trainee:!:: | trainee:!:: | ||
- | cockpit-wsinstance:!:: | + | systemd-coredump:!*:: |
- | rngd:!:: | + | mlocate:!:: |
- | gluster: | + | |
- | qemu:!:: | + | |
- | rpc:!:: | + | |
- | rpcuser: | + | |
- | saslauth: | + | |
- | libvirt: | + | |
- | radvd:!:: | + | |
- | dnsmasq: | + | |
- | screen:!:: | + | |
</ | </ | ||
Ligne 309: | Ligne 313: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# grpck -r |
- | [root@centos8 | + | root@debian11:~# |
</ | </ | ||
Dans le cas où vos fichiers ne comportent pas d' | Dans le cas où vos fichiers ne comportent pas d' | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : L' | **Important** : L' | ||
</ | </ | ||
Ligne 328: | Ligne 332: | ||
====Les Fichiers /etc/passwd et / | ====Les Fichiers /etc/passwd et / | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que la règle la plus libérale concernant les noms d' | **Important** : Notez que la règle la plus libérale concernant les noms d' | ||
</ | </ | ||
Ligne 335: | Ligne 339: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat /etc/passwd |
root: | root: | ||
- | bin:x:1:1:bin:/bin:/ | + | daemon:x:1:1:daemon:/usr/sbin:/usr/ |
- | daemon:x:2:2:daemon:/sbin:/ | + | bin:x:2:2:bin:/bin:/usr/ |
- | adm:x:3:4:adm:/var/adm:/ | + | sys:x:3:3:sys:/dev:/usr/ |
- | lp:x:4:7:lp:/var/ | + | sync:x:4:65534:sync:/bin:/bin/sync |
- | sync:x:5:0:sync:/sbin:/bin/sync | + | games:x:5:60:games:/usr/games:/usr/sbin/ |
- | shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown | + | man:x:6:12:man:/var/ |
- | halt:x:7:0:halt:/sbin:/sbin/halt | + | lp:x:7:7:lp:/var/ |
- | mail:x:8:12:mail:/var/spool/ | + | mail:x:8:8: |
- | operator:x:11:0:operator:/root:/sbin/nologin | + | news:x:9:9:news:/var/spool/news:/ |
- | games: | + | uucp:x:10:10:uucp:/var/spool/uucp:/usr/ |
- | ftp:x:14:50:FTP User:/var/ftp:/ | + | proxy:x:13:13:proxy:/bin:/usr/ |
- | nobody:x:65534:65534:Kernel Overflow User:/:/ | + | www-data:x:33:33:www-data:/var/www:/usr/ |
- | dbus:x:81:81:System message bus:/:/ | + | backup:x:34:34:backup:/var/backups:/usr/ |
- | systemd-coredump:x:999:997:systemd Core Dumper:/:/ | + | list:x:38:38:Mailing List Manager:/var/list:/usr/ |
- | systemd-resolve:x:193:193:systemd Resolver:/:/ | + | irc:x:39:39:ircd:/run/ircd:/usr/ |
- | tss:x:59:59:Account used by the trousers package to sandbox the tcsd daemon:/dev/null:/ | + | gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/ |
- | polkitd:x:998:996:User for polkitd:/:/ | + | nobody:x:65534:65534:nobody:/nonexistent:/usr/ |
- | unbound:x:997:994:Unbound DNS resolver:/etc/unbound:/ | + | _apt:x:100:65534::/nonexistent:/usr/ |
- | libstoragemgmt:x:996:993:daemon account for libstoragemgmt:/var/run/lsm:/ | + | systemd-network:x:101:102:systemd Network Management,,, |
- | cockpit-ws:x:995:991:User for cockpit-ws:/nonexisting:/ | + | systemd-resolve:x:102:103:systemd Resolver,,,:/run/systemd:/usr/ |
- | sssd:x:994:990:User for sssd:/:/ | + | messagebus:x:103:109::/nonexistent:/usr/ |
- | setroubleshoot:x:993:989::/var/ | + | systemd-timesync:x:104:110:systemd Time Synchronization,,, |
- | sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/ | + | usbmux:x:105:46:usbmux daemon,,,:/var/lib/usbmux:/usr/ |
- | chrony:x:992:988::/var/lib/chrony:/ | + | rtkit:x:106:113:RealtimeKit,,, |
- | tcpdump:x:72:72::/:/ | + | dnsmasq:x:107:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/ |
- | trainee:x:1000:1000:trainee:/home/trainee:/bin/bash | + | avahi:x:108:114:Avahi mDNS daemon,,,:/run/ |
- | cockpit-wsinstance:x:991:987:User for cockpit-ws instances:/nonexisting:/ | + | speech-dispatcher:x:109:29:Speech Dispatcher,,, |
- | rngd:x:990:986:Random Number Generator Daemon:/var/lib/rngd:/sbin/nologin | + | pulse:x:110:116:PulseAudio daemon,,,:/run/pulse:/usr/ |
- | gluster:x:989:985:GlusterFS daemons:/run/gluster:/ | + | saned:x:111:119::/var/ |
- | qemu:x:107:107:qemu user:/:/ | + | colord:x:112:120:colord colour management daemon,,,:/var/lib/colord:/usr/ |
- | rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/ | + | lightdm:x:113:121:Light Display Manager:/var/lib/lightdm:/bin/false |
- | rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin | + | trainee:x:1000:1000:trainee,,,:/home/trainee:/bin/bash |
- | saslauth:x:988:76:Saslauthd user:/run/saslauthd:/sbin/nologin | + | systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/ |
- | radvd:x:75:75:radvd user:/:/ | + | sshd:x:114:65534::/run/sshd:/usr/ |
- | dnsmasq:x:983:983:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/ | + | |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Notez que la valeur de l'UID de root est toujours de 0. Notez que sous RHEL / CentOS 8, les UID des utilisateurs normaux commencent à **1000** et les UID des comptes système sont inclus entre 1 et 99 et entre 201 et 999. | + | **Important** : Notez que la valeur de l'UID de root est toujours de 0. Notez que sous Debian 11, les UID des utilisateurs normaux commencent à **1000** et les UID des comptes système sont inclus entre 1 et 99 et entre 201 et 999. |
</ | </ | ||
Ligne 391: | Ligne 394: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | root:$6$9Sa1IumuSlJc8EBg$8jGU/4xGCXy64QuBSMyKOC6/ | + | root:$y$j9T$3oULwcP4KCW0crXb9zLB90$Tqr6eSITrKaEnKecir1vRGXpa1OdRRi3/Q.gLwLPph/:19107: |
- | bin:*:18264: | + | daemon:*:19107: |
- | daemon:*:18264: | + | bin:*:19107: |
- | adm:*:18264: | + | sys:*:19107: |
- | lp:*:18264: | + | sync:*:19107: |
- | sync:*:18264: | + | games:*:19107: |
- | shutdown:*:18264: | + | man:*:19107: |
- | halt:*:18264: | + | lp:*:19107: |
- | mail:*:18264: | + | mail:*:19107: |
- | operator:*:18264: | + | news:*:19107: |
- | games:*:18264: | + | uucp:*:19107: |
- | ftp:*:18264: | + | proxy:*:19107: |
- | nobody:*:18264: | + | www-data:*:19107: |
- | dbus:!!:18390:::::: | + | backup:*:19107:0:99999:7::: |
- | systemd-coredump:!!:18390:::::: | + | list:*:19107:0:99999:7::: |
- | systemd-resolve:!!:18390:::::: | + | irc:*:19107:0:99999:7::: |
- | tss:!!:18390:::::: | + | gnats:*:19107:0:99999:7::: |
- | polkitd:!!:18390:::::: | + | nobody:*:19107:0:99999:7::: |
- | unbound:!!:18390:::::: | + | _apt:*:19107:0:99999:7::: |
- | libstoragemgmt:!!:18390:::::: | + | systemd-network:*:19107:0:99999:7::: |
- | cockpit-ws:!!:18390:::::: | + | systemd-resolve:*:19107:0:99999:7::: |
- | sssd:!!:18390:::::: | + | messagebus:*:19107:0:99999:7::: |
- | setroubleshoot:!!:18390:::::: | + | systemd-timesync:*:19107:0:99999:7::: |
- | sshd:!!:18390:::::: | + | usbmux:*:19107:0:99999:7::: |
- | chrony:!!:18390:::::: | + | rtkit:*:19107:0:99999:7::: |
- | tcpdump:!!:18390:::::: | + | dnsmasq:*:19107:0:99999:7::: |
- | trainee:$6$p4HOAHX7UAzw1nQh$VZL12Lye.mR8v1IP2e4f0PCW8DzHj2MMAaA7r2ZLoTnQN7Ziskce3bo/ | + | avahi:*:19107: |
- | cockpit-wsinstance:!!:18736:::::: | + | speech-dispatcher:!:19107:0:99999:7::: |
- | rngd:!!:18736:::::: | + | pulse:*:19107:0:99999:7::: |
- | gluster:!!:18736:::::: | + | saned:*:19107:0:99999:7::: |
- | qemu:!!:18736:::::: | + | colord:*:19107:0:99999:7::: |
- | rpc:!!:18736: | + | lightdm:*:19107: |
- | rpcuser:!!:18736:::::: | + | trainee:$y$j9T$iKJ5MC8LmULY.yq58DCjw1$WsIdItQEonaSeCFZil61bk4YPxSp1.5aFg0uDhwIbZC:19107:0:99999:7::: |
- | saslauth:!!:18736:::::: | + | systemd-coredump:!*:19107:::::: |
- | radvd:!!:18736:::::: | + | sshd:*:19107:0:99999:7::: |
- | dnsmasq: | + | |
</ | </ | ||
Ligne 447: | Ligne 449: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# pwck -r |
- | user 'cockpit-ws': directory '/nonexisting' does not exist | + | user 'lp': directory '/var/ |
- | user 'cockpit-wsinstance': directory '/nonexisting' does not exist | + | user 'news': directory '/ |
- | user 'rngd': directory '/ | + | user ' |
- | user 'saslauth': directory '/run/saslauthd' does not exist | + | user 'www-data': directory '/var/www' does not exist |
+ | user 'list': directory '/ | ||
+ | user ' | ||
+ | user 'gnats': directory '/ | ||
+ | user 'nobody': directory '/nonexistent' | ||
+ | user ' | ||
pwck: no changes | pwck: no changes | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Les erreurs ci-dessus ne sont pas importantes. Elles sont dues au fait que les répertoires de connexion de certains comptes systèmes ne sont pas créés par le système lors de la création des comptes et ceci justement pour éviter la possibilité qu'un pirate ou un hacker puisse se connecter au système en utilisant le compte concerné. Encore une fois, l' | **Important** : Les erreurs ci-dessus ne sont pas importantes. Elles sont dues au fait que les répertoires de connexion de certains comptes systèmes ne sont pas créés par le système lors de la création des comptes et ceci justement pour éviter la possibilité qu'un pirate ou un hacker puisse se connecter au système en utilisant le compte concerné. Encore une fois, l' | ||
</ | </ | ||
Ligne 475: | Ligne 482: | ||
Cette commande est utilisée pour créer un groupe. | Cette commande est utilisée pour créer un groupe. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# groupadd --help |
Usage: groupadd [options] GROUP | Usage: groupadd [options] GROUP | ||
Ligne 495: | Ligne 502: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Il est possible de créer plusieurs groupes ayant le même GID. | **Important** : Il est possible de créer plusieurs groupes ayant le même GID. | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez l' | **Important** : Notez l' | ||
</ | </ | ||
Ligne 507: | Ligne 514: | ||
Cette commande est utilisée pour supprimer un groupe. | Cette commande est utilisée pour supprimer un groupe. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# groupdel --help |
Usage: groupdel [options] GROUP | Usage: groupdel [options] GROUP | ||
Ligne 524: | Ligne 531: | ||
Cette commande est utilisée pour modifier un groupe existant. | Cette commande est utilisée pour modifier un groupe existant. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# groupmod --help |
Usage: groupmod [options] GROUP | Usage: groupmod [options] GROUP | ||
Ligne 545: | Ligne 552: | ||
Cette commande est utilisée pour modifier le groupe de l' | Cette commande est utilisée pour modifier le groupe de l' | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# newgrp --help |
Usage: newgrp [-] [group] | Usage: newgrp [-] [group] | ||
</ | </ | ||
Ligne 554: | Ligne 561: | ||
===gpasswd=== | ===gpasswd=== | ||
- | Cette commande est utilisée pour modifier | + | Cette commande est utilisée pour administrer le fichier **/ |
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# gpasswd --help |
Usage: gpasswd [option] GROUP | Usage: gpasswd [option] GROUP | ||
Ligne 567: | Ligne 574: | ||
-h, --help | -h, --help | ||
-Q, --root CHROOT_DIR | -Q, --root CHROOT_DIR | ||
- | -r, --delete-password | + | -r, --remove-password |
-R, --restrict | -R, --restrict | ||
-M, --members USER, | -M, --members USER, | ||
Ligne 594: | Ligne 601: | ||
| 13 | Impossible de créer le spool mail de l' | | 13 | Impossible de créer le spool mail de l' | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# useradd --help |
Usage: useradd [options] LOGIN | Usage: useradd [options] LOGIN | ||
| | ||
Ligne 603: | Ligne 610: | ||
Options: | Options: | ||
+ | --badnames | ||
-b, --base-dir BASE_DIR | -b, --base-dir BASE_DIR | ||
new account | new account | ||
+ | --btrfs-subvolume-home | ||
-c, --comment COMMENT | -c, --comment COMMENT | ||
-d, --home-dir HOME_DIR | -d, --home-dir HOME_DIR | ||
Ligne 635: | Ligne 644: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Il est possible de créer plusieurs utilisateurs ayant le même UID. | **Important** : Il est possible de créer plusieurs utilisateurs ayant le même UID. | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez l' | **Important** : Notez l' | ||
</ | </ | ||
Ligne 647: | Ligne 656: | ||
Cette commande est utilisée pour supprimer un utilisateur. | Cette commande est utilisée pour supprimer un utilisateur. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# userdel --help |
Usage: userdel [options] LOGIN | Usage: userdel [options] LOGIN | ||
Options: | Options: | ||
- | -f, --force | + | -f, --force |
- | e.g. removal of user still logged in | + | even if not owned by user |
- | | + | |
-h, --help | -h, --help | ||
-r, --remove | -r, --remove | ||
Ligne 664: | Ligne 672: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que lors de la suppression d'un utilisateur, | **Important** : Notez que lors de la suppression d'un utilisateur, | ||
</ | </ | ||
Ligne 672: | Ligne 680: | ||
Cette commande est utilisée pour modifier un utilisateur existant. | Cette commande est utilisée pour modifier un utilisateur existant. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# usermod --help |
Usage: usermod [options] LOGIN | Usage: usermod [options] LOGIN | ||
Options: | Options: | ||
+ | -b, --badnames | ||
-c, --comment COMMENT | -c, --comment COMMENT | ||
-d, --home HOME_DIR | -d, --home HOME_DIR | ||
Ligne 708: | Ligne 717: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez l' | **Important** : Notez l' | ||
</ | </ | ||
Ligne 716: | Ligne 725: | ||
Cette commande est utilisée pour créer ou modifier le mot de passe d'un utilisateur. | Cette commande est utilisée pour créer ou modifier le mot de passe d'un utilisateur. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# passwd --help |
- | Usage: passwd [OPTION...] < | + | Usage: passwd [options] [LOGIN] |
- | -k, --keep-tokens | + | |
- | -d, --delete | + | |
- | -l, --lock | + | |
- | -u, --unlock | + | |
- | -e, --expire | + | |
- | -f, --force | + | |
- | -x, --maximum=DAYS | + | |
- | -n, --minimum=DAYS | + | |
- | -w, --warning=DAYS | + | |
- | -i, --inactive=DAYS | + | |
- | -S, --status | + | |
- | --stdin | + | |
- | Help options: | + | Options: |
- | -?, --help | + | -a, --all |
- | --usage | + | -d, --delete |
+ | -e, --expire | ||
+ | -h, --help | ||
+ | -k, --keep-tokens | ||
+ | -i, --inactive INACTIVE | ||
+ | to INACTIVE | ||
+ | -l, --lock | ||
+ | -n, --mindays MIN_DAYS | ||
+ | change to MIN_DAYS | ||
+ | -q, --quiet | ||
+ | -r, --repository REPOSITORY | ||
+ | -R, --root CHROOT_DIR | ||
+ | -S, --status | ||
+ | -u, --unlock | ||
+ | -w, --warndays WARN_DAYS | ||
+ | -x, --maxdays MAX_DAYS | ||
+ | change to MAX_DAYS | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez l' | **Important** : Notez l' | ||
</ | </ | ||
Ligne 747: | Ligne 760: | ||
La commande chage modifie le nombre de jours entre les changements de mot de passe et la date du dernier changement. Ces informations sont utilisées par le système pour déterminer si un utilisateur doit changer son mot de passe. | La commande chage modifie le nombre de jours entre les changements de mot de passe et la date du dernier changement. Ces informations sont utilisées par le système pour déterminer si un utilisateur doit changer son mot de passe. | ||
- | ==Options | + | Les options |
< | < | ||
- | [root@centos8 | + | root@debian11:~# chage --help |
Usage: chage [options] LOGIN | Usage: chage [options] LOGIN | ||
Ligne 757: | Ligne 770: | ||
-E, --expiredate EXPIRE_DATE | -E, --expiredate EXPIRE_DATE | ||
-h, --help | -h, --help | ||
+ | -i, --iso8601 | ||
-I, --inactive INACTIVE | -I, --inactive INACTIVE | ||
to INACTIVE | to INACTIVE | ||
Ligne 773: | Ligne 787: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | # useradd | + | # Default values for useradd(8) |
- | GROUP=100 | + | # |
- | HOME=/ | + | # The SHELL variable specifies the default login shell on your |
- | INACTIVE=-1 | + | # system. |
- | EXPIRE= | + | # Similar to DSHELL in adduser. However, we use " |
- | SHELL=/ | + | # useradd is a low level utility and should be as general |
- | SKEL=/ | + | # as possible |
- | CREATE_MAIL_SPOOL=yes | + | SHELL=/ |
+ | # | ||
+ | # The default group for users | ||
+ | # 100=users on Debian systems | ||
+ | # Same as USERS_GID in adduser | ||
+ | # This argument is used when the -n flag is specified. | ||
+ | # The default behavior (when -n and -g are not specified) is to create a | ||
+ | # primary user group with the same name as the user being added to the | ||
+ | # system. | ||
+ | # GROUP=100 | ||
+ | # | ||
+ | # The default home directory. Same as DHOME for adduser | ||
+ | # HOME=/ | ||
+ | # | ||
+ | # The number of days after a password expires until the account | ||
+ | # is permanently disabled | ||
+ | # INACTIVE=-1 | ||
+ | # | ||
+ | # The default expire date | ||
+ | # EXPIRE= | ||
+ | # | ||
+ | # The SKEL variable specifies the directory containing " | ||
+ | # files; in other words, files such as a sample .profile that will be | ||
+ | # copied to the new user's home directory when it is created. | ||
+ | # SKEL=/ | ||
+ | # | ||
+ | # Defines whether the mail spool should be created while | ||
+ | # creating the account | ||
+ | # CREATE_MAIL_SPOOL=yes | ||
</ | </ | ||
Dans ce fichier, nous trouvons les directives suivantes : | Dans ce fichier, nous trouvons les directives suivantes : | ||
+ | * **SHELL** - renseigne le shell de l' | ||
* **GROUP** - identifie le groupe principal par défaut de l' | * **GROUP** - identifie le groupe principal par défaut de l' | ||
* **HOME** - indique que le répertoire personnel de l' | * **HOME** - indique que le répertoire personnel de l' | ||
* **INACTIVE** - indique le nombre de jours d' | * **INACTIVE** - indique le nombre de jours d' | ||
* **EXPIRE** - sans valeur, cette directive indique que le mot de passe de l' | * **EXPIRE** - sans valeur, cette directive indique que le mot de passe de l' | ||
- | * **SHELL** - renseigne le shell de l' | ||
* **SKEL** - indique le répertoire contenant les fichiers qui seront copiés vers le répertoire personnel de l' | * **SKEL** - indique le répertoire contenant les fichiers qui seront copiés vers le répertoire personnel de l' | ||
* **CREATE_MAIL_SPOOL** - indique si oui ou non une boite mail interne au système sera créée pour l' | * **CREATE_MAIL_SPOOL** - indique si oui ou non une boite mail interne au système sera créée pour l' | ||
- | Cette même information peut être visualisée | + | Il est aussi possible de renseigner la valeur de la directive suivante : |
+ | |||
+ | * **UMASK** - indique l' | ||
+ | |||
+ | Ces mêmes informations peuvent | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# useradd -D |
GROUP=100 | GROUP=100 | ||
HOME=/home | HOME=/home | ||
INACTIVE=-1 | INACTIVE=-1 | ||
EXPIRE= | EXPIRE= | ||
- | SHELL=/bin/bash | + | SHELL=/bin/sh |
SKEL=/ | SKEL=/ | ||
- | CREATE_MAIL_SPOOL=yes | + | CREATE_MAIL_SPOOL=no |
</ | </ | ||
Ligne 811: | Ligne 856: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# ls -la /etc/skel |
- | total 24 | + | total 20 |
- | drwxr-xr-x. 2 root root 62 Apr 19 11:50 . | + | drwxr-xr-x |
- | drwxr-xr-x. 106 root root 8192 Apr 20 10:17 .. | + | drwxr-xr-x |
- | -rw-r--r--. 1 root root 18 Jul 21 2020 .bash_logout | + | -rw-r--r-- |
- | -rw-r--r--. 1 root root | + | -rw-r--r-- |
- | -rw-r--r--. 1 root root | + | -rw-r--r-- |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Notez que sous RHEL / CentOS | + | **Important** : Notez que sous Debian |
</ | </ | ||
Ligne 828: | Ligne 872: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# id trainee |
- | uid=1000(trainee) gid=1000(trainee) groups=1000(trainee) | + | uid=1000(trainee) gid=1000(trainee) groups=1000(trainee), |
</ | </ | ||
Ligne 835: | Ligne 879: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# groups trainee |
- | trainee : trainee | + | trainee : trainee |
</ | </ | ||
Ligne 849: | Ligne 893: | ||
UID_MAX | UID_MAX | ||
# System accounts | # System accounts | ||
- | SYS_UID_MIN | + | #SYS_UID_MIN |
- | SYS_UID_MAX | + | #SYS_UID_MAX |
# | # | ||
Ligne 858: | Ligne 902: | ||
GID_MAX | GID_MAX | ||
# System accounts | # System accounts | ||
- | SYS_GID_MIN | + | #SYS_GID_MIN |
- | SYS_GID_MAX | + | #SYS_GID_MAX |
... | ... | ||
</ | </ | ||
Ligne 868: | Ligne 912: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# groupadd groupe1; groupadd groupe2; groupadd -g 1807 groupe3 |
</ | </ | ||
Ligne 874: | Ligne 918: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# useradd -g groupe2 fenestros2; useradd -g 1807 fenestros3; useradd -g groupe1 fenestros1 |
- | [root@centos8 | + | |
- | [root@centos8 | + | root@debian11:~# usermod -G groupe1, |
+ | |||
+ | root@debian11:~# usermod -c " | ||
</ | </ | ||
- | En consultant votre fichier **/ | + | En consultant |
< | < | ||
- | [root@centos8 | + | root@debian11:~# tail / |
- | gluster:x:989:985:GlusterFS daemons:/run/gluster:/ | + | pulse:x:110:116:PulseAudio daemon,,,:/run/pulse:/usr/ |
- | qemu:x:107:107:qemu user:/:/ | + | saned:x:111:119::/var/ |
- | rpc:x:32:32:Rpcbind Daemon:/var/lib/rpcbind:/ | + | colord:x:112:120:colord colour management daemon,,,:/var/lib/colord:/usr/ |
- | rpcuser:x:29:29:RPC Service User:/var/lib/nfs:/sbin/nologin | + | lightdm:x:113:121:Light Display Manager:/var/lib/lightdm:/bin/false |
- | saslauth:x:988:76:Saslauthd user:/run/saslauthd:/sbin/nologin | + | trainee:x:1000:1000:trainee,,,:/home/trainee:/bin/bash |
- | radvd:x:75:75:radvd user:/:/ | + | systemd-coredump:x:999:999:systemd Core Dumper:/:/usr/ |
- | dnsmasq:x:983:983:Dnsmasq DHCP and DNS server:/var/lib/dnsmasq:/ | + | sshd:x:114:65534::/run/sshd:/usr/ |
- | fenestros2: | + | fenestros2: |
- | fenestros3: | + | fenestros3: |
- | fenestros1: | + | fenestros1: |
</ | </ | ||
- | En regardant votre fichier **/ | + | En regardant |
< | < | ||
- | [root@centos8 | + | root@debian11:~# tail / |
- | rpc:x:32: | + | scanner:x:118:saned, |
- | rpcuser:x:29: | + | saned:x:119: |
- | saslauth:x:76: | + | colord:x:120: |
- | libvirt:x:984: | + | lightdm:x:121: |
- | radvd:x:75: | + | trainee:x:1000: |
- | dnsmasq:x:983: | + | systemd-coredump:x:999: |
- | screen:x:84: | + | mlocate:x:122: |
groupe1: | groupe1: | ||
groupe2: | groupe2: | ||
Ligne 914: | Ligne 960: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# gpasswd groupe3 |
Changing the password for group groupe3 | Changing the password for group groupe3 | ||
New Password: fenestros | New Password: fenestros | ||
- | Re-enter new password: fenestros | + | Re-enter new password: fenestros |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que les mots de passe saisis ne seront **pas** visibles. | **Important** : Notez que les mots de passe saisis ne seront **pas** visibles. | ||
</ | </ | ||
- | Consultez | + | Consultez |
< | < | ||
- | [root@centos8 | + | root@debian11:~# tail / |
- | rpc:!:: | + | scanner:!::saned, |
- | rpcuser:!:: | + | saned:!:: |
- | saslauth:!:: | + | colord:!:: |
- | libvirt:!:: | + | lightdm:!:: |
- | radvd:!:: | + | trainee:!:: |
- | dnsmasq:!!:: | + | systemd-coredump:!*:: |
- | screen:!:: | + | mlocate:!:: |
groupe1: | groupe1: | ||
groupe2:!:: | groupe2:!:: | ||
- | groupe3:$6$c0nWuaO.7BveY$qZ907ORU.vEOhlYcka.VCL1Im0obgxJg8g3SvWnEA3YiZc9TB3CXEU/8nnNNAg5fBAhct7PNUXdPXwsSsY0Zg0:: | + | groupe3:$6$QEb2./zgnba/w1$FZ6hbzzcsZmoraLn2tNUhXd3F8K8yUI14.u7cVp2GPteBLJ6h0iNcjnhCsjS5/ |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez la présence du mot de passe crypté pour le **groupe3**. | **Important** : Notez la présence du mot de passe crypté pour le **groupe3**. | ||
</ | </ | ||
Ligne 947: | Ligne 993: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# gpasswd -A fenestros1 groupe3 |
</ | </ | ||
- | Consultez | + | Consultez |
< | < | ||
- | [root@centos8 | + | root@debian11:~# tail / |
- | rpc:!:: | + | scanner:!::saned, |
- | rpcuser:!:: | + | saned:!:: |
- | saslauth:!:: | + | colord:!:: |
- | libvirt:!:: | + | lightdm:!:: |
- | radvd:!:: | + | trainee:!:: |
- | dnsmasq:!!:: | + | systemd-coredump:!*:: |
- | screen:!:: | + | mlocate:!:: |
groupe1: | groupe1: | ||
groupe2:!:: | groupe2:!:: | ||
- | groupe3:$6$c0nWuaO.7BveY$qZ907ORU.vEOhlYcka.VCL1Im0obgxJg8g3SvWnEA3YiZc9TB3CXEU/8nnNNAg5fBAhct7PNUXdPXwsSsY0Zg0: | + | groupe3:$6$QEb2./zgnba/w1$FZ6hbzzcsZmoraLn2tNUhXd3F8K8yUI14.u7cVp2GPteBLJ6h0iNcjnhCsjS5/ |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : L' | **Important** : L' | ||
</ | </ | ||
Ligne 973: | Ligne 1019: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# groupdel groupe3 |
groupdel: cannot remove the primary group of user ' | groupdel: cannot remove the primary group of user ' | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : En effet, vous ne pouvez pas supprimer un groupe tant qu'un utilisateur le possède comme son groupe principal. | **Important** : En effet, vous ne pouvez pas supprimer un groupe tant qu'un utilisateur le possède comme son groupe principal. | ||
</ | </ | ||
Ligne 984: | Ligne 1030: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# userdel fenestros3 |
</ | </ | ||
Ligne 990: | Ligne 1036: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# groupdel groupe3 |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
**Important** : Notez que cette fois-ci la commande est exécutée sans erreur. | **Important** : Notez que cette fois-ci la commande est exécutée sans erreur. | ||
</ | </ | ||
- | Le fait de supprimer un utilisateur **sans** l' | + | Le fait de supprimer un utilisateur **sans** l' |
- | Saisissez | + | Sous Debian les répertoires personnels des utilisateurs n'ont pas été créés parce que les directives n'ont pas été activées dans le fichier **/ |
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat /etc/default/ |
- | drwx------. 2 1002 groupe3 62 Apr 20 14:28 /home/fenestros3 | + | # Default values for useradd(8) |
+ | # | ||
+ | # The SHELL variable specifies the default login shell on your | ||
+ | # system. | ||
+ | # Similar to DSHELL in adduser. However, we use " | ||
+ | # useradd is a low level utility and should be as general | ||
+ | # as possible | ||
+ | SHELL=/ | ||
+ | # | ||
+ | # The default group for users | ||
+ | # 100=users on Debian systems | ||
+ | # Same as USERS_GID in adduser | ||
+ | # This argument is used when the -n flag is specified. | ||
+ | # The default behavior (when -n and -g are not specified) is to create a | ||
+ | # primary user group with the same name as the user being added to the | ||
+ | # system. | ||
+ | # GROUP=100 | ||
+ | # | ||
+ | # The default home directory. Same as DHOME for adduser | ||
+ | # HOME=/home | ||
+ | # | ||
+ | # The number of days after a password expires until the account | ||
+ | # is permanently disabled | ||
+ | # INACTIVE=-1 | ||
+ | # | ||
+ | # The default expire date | ||
+ | # EXPIRE= | ||
+ | # | ||
+ | # The SKEL variable specifies the directory containing " | ||
+ | # files; in other words, files such as a sample .profile that will be | ||
+ | # copied to the new user's home directory when it is created. | ||
+ | # SKEL=/etc/skel | ||
+ | # | ||
+ | # Defines whether the mail spool should be created while | ||
+ | # creating the account | ||
+ | # CREATE_MAIL_SPOOL=yes | ||
</ | </ | ||
- | Pour supprimer | + | Otez donc le caractère **#** devant |
< | < | ||
- | [root@centos8 | + | root@debian11:~# vi /etc/default/useradd |
- | find: ‘/home/fenestros3’: | + | |
- | [root@centos8 | + | root@debian11:~# cat /etc/default/useradd |
- | ls: cannot access '/home/fenestros3': | + | # Default values for useradd(8) |
+ | # | ||
+ | # The SHELL variable specifies the default login shell on your | ||
+ | # system. | ||
+ | # Similar to DSHELL in adduser. However, we use " | ||
+ | # useradd is a low level utility and should be as general | ||
+ | # as possible | ||
+ | SHELL=/bin/sh | ||
+ | # | ||
+ | # The default group for users | ||
+ | # 100=users on Debian systems | ||
+ | # Same as USERS_GID in adduser | ||
+ | # This argument is used when the -n flag is specified. | ||
+ | # The default behavior (when -n and -g are not specified) is to create a | ||
+ | # primary user group with the same name as the user being added to the | ||
+ | # system. | ||
+ | GROUP=100 | ||
+ | # | ||
+ | # The default | ||
+ | HOME=/home | ||
+ | # | ||
+ | # The number of days after a password expires until the account | ||
+ | # is permanently disabled | ||
+ | INACTIVE=-1 | ||
+ | # | ||
+ | # The default expire date | ||
+ | EXPIRE= | ||
+ | # | ||
+ | # The SKEL variable specifies the directory containing " | ||
+ | # files; in other words, files such as a sample .profile that will be | ||
+ | # copied to the new user's home directory | ||
+ | SKEL=/ | ||
+ | # | ||
+ | # Defines whether the mail spool should be created while | ||
+ | # creating the account | ||
+ | CREATE_MAIL_SPOOL=yes | ||
</ | </ | ||
- | <WRAP center round important 60%> | + | Pour tester la configuration, |
- | **Important** : La commande | + | |
- | </WRAP> | + | <code> |
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Vérifiez que l' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | total 8 | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x 17 trainee trainee 4096 Jun 3 17:39 trainee | ||
+ | </ | ||
+ | |||
+ | Créez maintenant les répertoires personnels de fenestros1 et fenestros2 : | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Copiez le contenu du répertoire | ||
+ | |||
+ | <code> | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | </code> | ||
+ | |||
+ | Modifiez le propriétaire et le groupe pour les répertoires **/ | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | root@debian11: | ||
+ | </code> | ||
Créez maintenant les mots de passe pour **fenestros1** et **fenestros2**. Indiquez un mot de passe identique au nom du compte : | Créez maintenant les mots de passe pour **fenestros1** et **fenestros2**. Indiquez un mot de passe identique au nom du compte : | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# passwd fenestros1 |
- | Changing password for user fenestros1. | + | |
New password: fenestros1 | New password: fenestros1 | ||
- | BAD PASSWORD: The password contains the user name in some form | ||
Retype new password: fenestros1 | Retype new password: fenestros1 | ||
- | passwd: | + | passwd: |
- | [root@centos8 | + | root@debian11:~# passwd fenestros2 |
- | Changing password for user fenestros2. | + | |
New password: fenestros2 | New password: fenestros2 | ||
- | BAD PASSWORD: The password contains the user name in some form | ||
Retype new password: fenestros2 | Retype new password: fenestros2 | ||
- | passwd: | + | passwd: |
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Notez que les règles | + | **Important** : Notez que les règles |
</ | </ | ||
=====LAB #2 - Forcer l' | =====LAB #2 - Forcer l' | ||
+ | |||
+ | ====2.1 - Présentation de PAM==== | ||
**PAM** ( //Pluggable Authentification Modules// ou Modules d' | **PAM** ( //Pluggable Authentification Modules// ou Modules d' | ||
Ligne 1047: | Ligne 1192: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# ls -l / |
- | total 88 | + | total 104 |
- | -rw-r--r--. 1 root root 272 May 11 2019 atd | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 192 Jul 21 | + | -rw-r--r-- 1 root root 92 Feb 7 |
- | -rw-r--r--. 1 root root 192 Jul 21 2020 chsh | + | -rw-r--r-- 1 root root 581 Feb 7 2020 chsh |
- | -rw-r--r--. 1 root root 997 Aug 19 2020 cockpit | + | -rw-r--r-- 1 root root 1208 Apr 25 06:49 common-account |
- | -rw-r--r--. 1 root root 232 Jun 15 2020 config-util | + | -rw-r--r-- 1 root root 1214 Apr 25 06:49 common-auth |
- | -rw-r--r--. 1 root root 328 Nov 8 2019 crond | + | -rw-r--r-- 1 root root 1660 Apr 25 06:49 common-password |
- | lrwxrwxrwx. 1 root root 32 Apr 19 11:54 fingerprint-auth -> / | + | -rw-r--r-- 1 root root 1146 Apr 25 06:49 common-session |
- | -rw-r--r--. 1 root root 715 Jul 21 2020 login | + | -rw-r--r-- 1 root root 1154 Apr 25 06:49 common-session-noninteractive |
- | -rw-r--r--. 1 root root 154 Jun 15 2020 other | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 168 Apr 6 2020 passwd | + | -rw-r--r-- |
- | lrwxrwxrwx. | + | -rw-r--r-- 1 root root 1354 Feb 3 |
- | -rw-r--r--. 1 root root 155 Apr 9 | + | -rw-r--r-- 1 root root 1428 Feb 3 2020 lightdm-autologin |
- | lrwxrwxrwx. | + | -rw-r--r-- 1 root root 493 Feb 3 |
- | -rw-r--r--. 1 root root 640 Jul 21 | + | -rw-r--r-- 1 root root 4126 Feb 7 |
- | -rw-r--r--. 1 root root 143 Jul 21 | + | -rw-r--r-- 1 root root 92 Feb 7 |
- | -rw-r--r--. 1 root root 138 Jul 21 | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root | + | -rw-r--r-- 1 root root 92 Feb 7 |
- | lrwxrwxrwx. 1 root root 30 Apr 19 11:54 smartcard-auth -> / | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 727 Apr 26 | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 214 Sep 17 2020 sssd-shadowutils | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 566 Jul 21 2020 su | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 154 Jan 26 16:58 sudo | + | -rw-r--r-- 1 root root 2133 Mar 13 2021 sshd |
- | -rw-r--r--. 1 root root 178 Jan 26 16:58 sudo-i | + | -rw-r--r-- 1 root root 2259 Jan 20 20:55 su |
- | -rw-r--r--. 1 root root 137 Jul 21 2020 su-l | + | -rw-r--r-- 1 root root 95 Feb 27 2021 sudo |
- | lrwxrwxrwx. | + | -rw-r--r-- 1 root root |
- | -rw-r--r--. 1 root root 248 Apr 7 16:55 systemd-user | + | |
- | -rw-r--r--. 1 root root | + | |
</ | </ | ||
- | Ces fichiers ont une structure spécifique et sont nommés d' | + | Ces fichiers ont une structure spécifique et sont nommés d' |
< | < | ||
- | [root@centos8 | + | root@debian11:~# ls /lib/x86_64-linux-gnu/security |
- | total 1880 | + | pam_access.so |
- | -rwxr-xr-x. 1 root root 19992 Jun 15 2020 pam_access.so | + | pam_debug.so |
- | -rwxr-xr-x. 1 root root 15680 Jun 15 2020 pam_cap.so | + | pam_deny.so |
- | -rwxr-xr-x. 1 root root 11624 Jun 15 2020 pam_chroot.so | + | pam_echo.so |
- | -rwxr-xr-x. 1 root root 16168 Aug 24 2020 pam_cockpit_cert.so | + | pam_env.so pam_gnome_keyring.so |
- | -rwxr-xr-x. 1 root root 28904 Jun 15 2020 pam_console.so | + | pam_exec.so |
- | -rwxr-xr-x. 1 root root 19888 Jun 15 2020 pam_cracklib.so | + | |
- | -rwxr-xr-x. 1 root root 11712 Jun 15 2020 pam_debug.so | + | |
- | -rwxr-xr-x. 1 root root | + | |
- | -rwxr-xr-x. 1 root root 11728 Jun 15 2020 pam_echo.so | + | |
- | -rwxr-xr-x. 1 root root 20080 Jun 15 2020 pam_env.so | + | |
- | -rwxr-xr-x. 1 root root 15792 Jun 15 2020 pam_exec.so | + | |
- | -rwxr-xr-x. 1 root root 11640 Jun 15 2020 pam_faildelay.so | + | |
- | -rwxr-xr-x. 1 root root 20424 Jun 15 2020 pam_faillock.so | + | |
- | drwxr-xr-x. 2 root root 24 Apr 19 11:50 pam_filter | + | |
- | -rwxr-xr-x. 1 root root 15824 Jun 15 2020 pam_filter.so | + | |
- | -rwxr-xr-x. 1 root root 28864 Apr 14 2020 pam_fprintd.so | + | |
- | -rwxr-xr-x. 1 root root 11632 Jun 15 2020 pam_ftp.so | + | |
- | -rwxr-xr-x. 1 root root 15800 Jun 15 2020 pam_group.so | + | |
- | -rwxr-xr-x. 1 root root 11664 Jun 15 2020 pam_issue.so | + | |
- | -rwxr-xr-x. 1 root root 11656 Jun 15 2020 pam_keyinit.so | + | |
- | -rwxr-xr-x. 1 root root 20048 Jun 15 2020 pam_lastlog.so | + | |
- | -rwxr-xr-x. 1 root root 23968 Jun 15 2020 pam_limits.so | + | |
- | -rwxr-xr-x. 1 root root 11672 Jun 15 2020 pam_listfile.so | + | |
- | -rwxr-xr-x. 1 root root 11664 Jun 15 2020 pam_localuser.so | + | |
- | -rwxr-xr-x. 1 root root 11680 Jun 15 2020 pam_loginuid.so | + | |
- | -rwxr-xr-x. 1 root root 15768 Jun 15 2020 pam_mail.so | + | |
- | -rwxr-xr-x. 1 root root 11624 Jun 15 2020 pam_mkhomedir.so | + | |
- | -rwxr-xr-x. 1 root root 11760 Jun 15 2020 pam_motd.so | + | |
- | -rwxr-xr-x. 1 root root 45232 Jun 15 2020 pam_namespace.so | + | |
- | -rwxr-xr-x. 1 root root 11688 Jun 15 2020 pam_nologin.so | + | |
- | -rwxr-xr-x. 1 root root 41672 Nov 3 11:34 pam_oddjob_mkhomedir.so | + | |
- | -rwxr-xr-x. 1 root root 7560 Jun 15 2020 pam_permit.so | + | |
- | -rwxr-xr-x. 1 root root 7536 Jun 15 2020 pam_postgresok.so | + | |
- | -rwxr-xr-x. 1 root root 20344 Jun 15 2020 pam_pwhistory.so | + | |
- | -rwxr-xr-x. 1 root root 11896 May 10 2019 pam_pwquality.so | + | |
- | -rwxr-xr-x. 1 root root 11632 Jun 15 2020 pam_rhosts.so | + | |
- | -rwxr-xr-x. 1 root root 11688 Jun 15 2020 pam_rootok.so | + | |
- | -rwxr-xr-x. 1 root root 11688 Jun 15 2020 pam_securetty.so | + | |
- | lrwxrwxrwx. 1 root root | + | |
- | -rwxr-xr-x. 1 root root 24088 Jun 15 2020 pam_selinux.so | + | |
- | -rwxr-xr-x. 1 root root 15800 Jun 15 2020 pam_sepermit.so | + | |
- | -rwxr-xr-x. 1 root root 11656 Jun 15 2020 pam_shells.so | + | |
- | -rwxr-xr-x. 1 root root 24272 Aug 24 2020 pam_ssh_add.so | + | |
- | -rwxr-xr-x. 1 root root 54088 Sep 17 2020 pam_sss.so | + | |
- | -rwxr-xr-x. 1 root root 15864 Jun 15 2020 pam_stress.so | + | |
- | -rwxr-xr-x. 1 root root 15848 Jun 15 2020 pam_succeed_if.so | + | |
- | -rwxr-xr-x. 1 root root 906728 Apr 7 16:56 pam_systemd.so | + | |
- | -rwxr-xr-x. 1 root root 15784 Jun 15 2020 pam_time.so | + | |
- | -rwxr-xr-x. 1 root root 24664 Jun 15 2020 pam_timestamp.so | + | |
- | -rwxr-xr-x. 1 root root 15792 Jun 15 2020 pam_tty_audit.so | + | |
- | -rwxr-xr-x. 1 root root 11648 Jun 15 2020 pam_umask.so | + | |
- | lrwxrwxrwx. 1 root root 11 Jun 15 2020 pam_unix_acct.so -> pam_unix.so | + | |
- | lrwxrwxrwx. 1 root root | + | |
- | lrwxrwxrwx. 1 root root 11 Jun 15 2020 pam_unix_passwd.so -> pam_unix.so | + | |
- | lrwxrwxrwx. 1 root root 11 Jun 15 2020 pam_unix_session.so -> pam_unix.so | + | |
- | -rwxr-xr-x. 1 root root 57856 Jun 15 2020 pam_unix.so | + | |
- | -rwxr-xr-x. 1 root root 15800 Jun 15 2020 pam_userdb.so | + | |
- | -rwxr-xr-x. 1 root root 11736 Jun 15 2020 pam_usertype.so | + | |
- | -rwxr-xr-x. 1 root root 7576 Jun 15 2020 pam_warn.so | + | |
- | -rwxr-xr-x. 1 root root 11672 Jun 15 2020 pam_wheel.so | + | |
- | -rwxr-xr-x. 1 root root 23960 Jun 15 2020 pam_xauth.so | + | |
</ | </ | ||
Ligne 1154: | Ligne 1241: | ||
| pam_listfile.so | Ce module est utilisé pour consulter un fichier spécifique pour vérifier les authiorisations. Par exemple, le service ftp utilise ce module pour consulter le fichier **/ | | pam_listfile.so | Ce module est utilisé pour consulter un fichier spécifique pour vérifier les authiorisations. Par exemple, le service ftp utilise ce module pour consulter le fichier **/ | ||
| pam_nologin.so | Ce module interdit les connexions d' | | pam_nologin.so | Ce module interdit les connexions d' | ||
- | | pam_pwquality.so | Ce module est utilisé pour vérifier la qualité du mot de passe d'un utilisateur | | ||
| pam_securetty.so | Ce module interdit des connexions de root à partir des périphériques tty qui ne sont pas listés dans le fichier **/ | | pam_securetty.so | Ce module interdit des connexions de root à partir des périphériques tty qui ne sont pas listés dans le fichier **/ | ||
| pam_unix.so | Ce module est utilisé pour vérifier les informations suivantes ; expire, last_change, | | pam_unix.so | Ce module est utilisé pour vérifier les informations suivantes ; expire, last_change, | ||
Ligne 1161: | Ligne 1247: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | #%PAM-1.0 | + | # |
- | auth substack | + | # The PAM configuration file for the Shadow `login' |
- | auth include | + | # |
- | account | + | |
- | account | + | # Enforce a minimal delay in case of failure (in microseconds). |
- | password | + | # (Replaces the `FAIL_DELAY' |
- | # pam_selinux.so close should | + | # Note that other modules may require another minimal delay. (for example, |
- | session | + | # to disable any delay, you should add the nodelay option to pam_unix) |
+ | auth optional | ||
+ | |||
+ | # Outputs an issue file prior to each login prompt (Replaces the | ||
+ | # ISSUE_FILE option from login.defs). Uncomment for use | ||
+ | # auth | ||
+ | |||
+ | # Disallows other than root logins when / | ||
+ | # (Replaces the `NOLOGINS_FILE' | ||
+ | auth | ||
+ | |||
+ | # SELinux needs to be the first session rule. This ensures that any | ||
+ | # lingering context has been cleared. Without this it is possible | ||
+ | # that a module could execute code in the wrong domain. | ||
+ | # When the module is present, "required" would be sufficient (When SELinux | ||
+ | # is disabled, this returns success.) | ||
+ | session [success=ok ignore=ignore module_unknown=ignore default=bad] | ||
+ | |||
+ | # Sets the loginuid process attribute | ||
session | session | ||
- | session | + | |
- | # pam_selinux.so open should only be followed by sessions | + | # Prints the message of the day upon successful login. |
- | session | + | # (Replaces the `MOTD_FILE' |
- | session | + | # This includes a dynamically generated part from / |
- | session | + | # and a static (admin-editable) part from / |
- | session | + | session |
- | session | + | session |
- | -session | + | |
+ | # SELinux needs to intervene at login time to ensure that the process | ||
+ | # starts in the proper default security context. Only sessions which are | ||
+ | # intended to run in the user's context should be run after this. | ||
+ | # pam_selinux.so changes the SELinux context of the used TTY and configures | ||
+ | # SELinux in order to transition to the user context with the next execve() | ||
+ | # call. | ||
+ | session [success=ok ignore=ignore module_unknown=ignore default=bad] | ||
+ | # When the module is present, " | ||
+ | # is disabled, this returns success.) | ||
+ | |||
+ | # This module parses environment configuration file(s) | ||
+ | # and also allows you to use an extended config | ||
+ | # file / | ||
+ | # | ||
+ | # parsing / | ||
+ | session | ||
+ | # locale variables are also kept into / | ||
+ | # reading this file *in addition to / | ||
+ | session | ||
+ | |||
+ | # Standard Un*x authentication. | ||
+ | @include common-auth | ||
+ | |||
+ | # This allows certain extra groups | ||
+ | # based on things like time of day, tty, service, and user. | ||
+ | # Please edit / | ||
+ | # (Replaces the `CONSOLE_GROUPS' | ||
+ | auth | ||
+ | |||
+ | # Uncomment and edit / | ||
+ | # time restraint on logins. | ||
+ | # (Replaces | ||
+ | # as well as / | ||
+ | # account | ||
+ | |||
+ | # Uncomment and edit / | ||
+ | # set access limits. | ||
+ | # (Replaces / | ||
+ | # account | ||
+ | |||
+ | # Sets up user limits according to / | ||
+ | # (Replaces the use of /etc/limits in old login) | ||
+ | session | ||
+ | |||
+ | # Prints the last login info upon successful login | ||
+ | # (Replaces the `LASTLOG_ENAB' | ||
+ | session | ||
+ | |||
+ | # Prints the status of the user's mailbox upon successful login | ||
+ | # (Replaces the `MAIL_CHECK_ENAB' | ||
+ | # | ||
+ | # This also defines the MAIL environment variable | ||
+ | # However, userdel also needs MAIL_DIR and MAIL_FILE variables | ||
+ | # in / | ||
+ | # also removes the user's mail spool file. | ||
+ | # See comments in / | ||
+ | session | ||
+ | |||
+ | # Create a new session keyring. | ||
+ | session | ||
+ | |||
+ | # Standard Un*x account and session | ||
+ | @include | ||
+ | @include | ||
+ | @include common-password | ||
</ | </ | ||
Ligne 1203: | Ligne 1372: | ||
| **sufficient** | La réussite de ce module est suffisant pour authoriser l' | | **sufficient** | La réussite de ce module est suffisant pour authoriser l' | ||
| **optional** | La réussite ou l' | | **optional** | La réussite ou l' | ||
- | | **include** | Ce control-flag permet d' | + | | **@include** | Ce control-flag permet d' |
- | Le **troisième champs** stipule le // | + | Le **troisième champs** stipule le // |
Le **quatrième champs** contient éventuellement les **arguments**. | Le **quatrième champs** contient éventuellement les **arguments**. | ||
Ligne 1212: | Ligne 1381: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | #%PAM-1.0 | + | # |
- | auth | + | # / |
- | account | + | # |
- | password required | + | # Note that this file is used for any unspecified service; for example |
- | session | + | #if /etc/pam.d/ |
- | </ | + | # |
+ | # | ||
+ | #pam_deny.so | ||
- | ===Utiliser des Mots de Passe Complexes=== | + | # We fall back to the system default in / |
+ | # | ||
+ | |||
+ | @include common-auth | ||
+ | @include common-account | ||
+ | @include common-password | ||
+ | @include common-session | ||
+ | </ | ||
- | ===Configuration=== | + | ====2.2 - Configuration |
Certains modules de PAM peuvent être configurés grâce aux fichiers présents dans le répertoire **/ | Certains modules de PAM peuvent être configurés grâce aux fichiers présents dans le répertoire **/ | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# ls -l / |
- | access.conf | + | total 48 |
- | chroot.conf console.perms.d namespace.conf | + | -rw-r--r-- 1 root root 4564 Aug 26 2021 access.conf |
- | console.apps | + | -rw-r--r-- 1 root root 2234 Aug 26 2021 faillock.conf |
- | console.handlers | + | -rw-r--r-- 1 root root 3635 Aug 26 2021 group.conf |
+ | -rw-r--r-- 1 root root 2161 Aug 26 2021 limits.conf | ||
+ | drwxr-xr-x 2 root root 4096 Aug 26 2021 limits.d | ||
+ | -rw-r--r-- 1 root root 1637 Aug 26 2021 namespace.conf | ||
+ | drwxr-xr-x 2 root root 4096 Aug 26 2021 namespace.d | ||
+ | -rwxr-xr-x 1 root root 1016 Aug 26 2021 namespace.init | ||
+ | -rw------- 1 root root 0 Apr 25 06:30 opasswd | ||
+ | -rw-r--r-- 1 root root 2971 Aug 26 2021 pam_env.conf | ||
+ | -rw-r--r-- 1 root root 419 Aug 26 2021 sepermit.conf | ||
+ | -rw-r--r-- 1 root root 2179 Aug 26 2021 time.conf | ||
</ | </ | ||
Parmi les fichiers cités on note ceux qui peuvent être utilisés pour configurer les modules suivants : | Parmi les fichiers cités on note ceux qui peuvent être utilisés pour configurer les modules suivants : | ||
- | ^ Fichier/// | + | ^ Fichier/// |
- | | **access.conf** | Utilisé par le module | + | | **access.conf** | pam_access.so | |
- | | **//console.apps//** | Utilisés par le module pam_console.so | | + | | **faillock.conf** | pam_faillock.so | |
- | | **console.perms** | Utilisé par le module pam_console.so | | + | | **group.conf** | pam_group.so | |
- | | **//console.perms.d//** | Utilisé par le module pam_console.so | | + | | **limits.conf** | pam_limits.so | |
- | | **group.conf** | Utilisés par le module pam_group.so | | + | | **namespace.conf** | pam_namespace.so | |
- | | **limits.conf** | Utilisé par le module pam_limits.so | | + | | **pam_env.conf** | pam_env.so | |
- | | **pam_env.conf** | Utilisé par le module pam_env.so | | + | | **sepermit.conf** | pam_sepermit.so | |
- | | **pwquality.conf** | Utilisé par le module pam_cracklib.so | | + | | **time.conf** | pam_time.so | |
- | | **time.conf** | Utilisé | + | |
+ | ====2.3 - Utiliser des Mots de Passe Complexes==== | ||
+ | |||
+ | La complexité des mots de passe est gérée par le module | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | </ | ||
+ | |||
+ | Vérifiez la présence du module | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | pam_pwquality.so | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | root@debian11: | ||
+ | -rw-r--r-- 1 root root 2674 Dec 17 2020 / | ||
+ | </ | ||
- | La complexité des mots de passe est gérée par le module pam_pwquality.so. | + | Afin de mettre en place une politique de mots de passe complexe, il convient de modifier le fichier **/ |
< | < | ||
- | [root@centos8 | + | root@debian11:~# vi / |
- | [root@centos8 | + | root@debian11:~# cat / |
# Configuration for systemwide password quality limits | # Configuration for systemwide password quality limits | ||
# Defaults: | # Defaults: | ||
Ligne 1266: | Ligne 1474: | ||
# The maximum credit for having digits in the new password. If less than 0 | # The maximum credit for having digits in the new password. If less than 0 | ||
# it is the minimum number of digits in the new password. | # it is the minimum number of digits in the new password. | ||
- | dcredit = -2 | + | dcredit = -2 |
# | # | ||
# The maximum credit for having uppercase characters in the new password. | # The maximum credit for having uppercase characters in the new password. | ||
# If less than 0 it is the minimum number of uppercase characters in the new | # If less than 0 it is the minimum number of uppercase characters in the new | ||
# password. | # password. | ||
- | ucredit = -1 | + | ucredit = -1 |
# | # | ||
# The maximum credit for having lowercase characters in the new password. | # The maximum credit for having lowercase characters in the new password. | ||
# If less than 0 it is the minimum number of lowercase characters in the new | # If less than 0 it is the minimum number of lowercase characters in the new | ||
# password. | # password. | ||
- | lcredit = -1 | + | lcredit = -1 |
# | # | ||
# The maximum credit for having other characters in the new password. | # The maximum credit for having other characters in the new password. | ||
# If less than 0 it is the minimum number of other characters in the new | # If less than 0 it is the minimum number of other characters in the new | ||
# password. | # password. | ||
- | ocredit = -1 | + | ocredit = -1 |
# | # | ||
# The minimum number of required classes of characters for the new | # The minimum number of required classes of characters for the new | ||
# password (digits, uppercase, lowercase, others). | # password (digits, uppercase, lowercase, others). | ||
- | minclass = 4 | + | minclass = 4 |
# | # | ||
# The maximum number of allowed consecutive same characters in the new password. | # The maximum number of allowed consecutive same characters in the new password. | ||
Ligne 1298: | Ligne 1506: | ||
# Whether to check for the words from the passwd entry GECOS string of the user. | # Whether to check for the words from the passwd entry GECOS string of the user. | ||
# The check is enabled if the value is not 0. | # The check is enabled if the value is not 0. | ||
- | gecoscheck = 1 | + | gecoscheck = 1 |
# | # | ||
# Whether to check for the words from the cracklib dictionary. | # Whether to check for the words from the cracklib dictionary. | ||
Ligne 1307: | Ligne 1515: | ||
# The check is enabled if the value is not 0. | # The check is enabled if the value is not 0. | ||
usercheck = 1 | usercheck = 1 | ||
+ | # | ||
+ | # Length of substrings from the username to check for in the password | ||
+ | # The check is enabled if the value is greater than 0 and usercheck is enabled. | ||
+ | # usersubstr = 0 | ||
# | # | ||
# Whether the check is enforced by the PAM module and possibly other | # Whether the check is enforced by the PAM module and possibly other | ||
Ligne 1315: | Ligne 1527: | ||
# Path to the cracklib dictionaries. Default is to use the cracklib default. | # Path to the cracklib dictionaries. Default is to use the cracklib default. | ||
# dictpath = | # dictpath = | ||
+ | # | ||
+ | # Prompt user at most N times before returning with error. The default is 1. | ||
+ | # retry = 3 | ||
+ | # | ||
+ | # Enforces pwquality checks on the root user password. | ||
+ | # Enabled if the option is present. | ||
+ | # enforce_for_root | ||
+ | # | ||
+ | # Skip testing the password quality for users that are not present in the | ||
+ | # /etc/passwd file. | ||
+ | # Enabled if the option is present. | ||
+ | # local_users_only | ||
</ | </ | ||
- | =====su et su - ===== | + | =====LAB #3 - su et su - ===== |
Vous allez maintenant devenir **fenestros2**, | Vous allez maintenant devenir **fenestros2**, | ||
Ligne 1324: | Ligne 1548: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# pwd |
/root | /root | ||
</ | </ | ||
Ligne 1331: | Ligne 1555: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# su fenestros2 |
</ | </ | ||
Ligne 1337: | Ligne 1561: | ||
< | < | ||
- | [fenestros2@centos8 root]$ pwd | + | $ pwd |
/root | /root | ||
</ | </ | ||
Ligne 1343: | Ligne 1567: | ||
Vous noterez que vous êtes toujours dans le répertoire **/root**. Ceci indique que vous avez gardé l' | Vous noterez que vous êtes toujours dans le répertoire **/root**. Ceci indique que vous avez gardé l' | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : L' | + | **Important** : L' |
</ | </ | ||
Ligne 1350: | Ligne 1574: | ||
< | < | ||
- | [fenestros2@centos8 root]$ exit | + | $ exit |
- | exit | + | root@debian11: |
</ | </ | ||
Ligne 1357: | Ligne 1581: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# su - fenestros2 |
- | Last login: Thu Oct 15 18:30:54 CEST 2015 on pts/0 | + | |
</ | </ | ||
Ligne 1364: | Ligne 1587: | ||
< | < | ||
- | [fenestros2@centos8 ~]$ pwd | + | $ pwd |
/ | / | ||
</ | </ | ||
Ligne 1370: | Ligne 1593: | ||
Vous noterez que vous êtes maintenant dans le répertoire **/ | Vous noterez que vous êtes maintenant dans le répertoire **/ | ||
- | <WRAP center round important 60%> | + | Saisissez la commande suivante pour redevenir |
- | **Important** : Notez que **root** peut devenir n' | + | |
- | </ | + | |
- | =====sudo===== | + | < |
+ | $ exit | ||
+ | root@debian11: | ||
+ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Afin de mettre en pratique les exemples qui suivent, vous devez être connecté à votre système en tant que root. Tapez donc la commande | + | **Important** : Notez que **root** peut devenir n' |
</ | </ | ||
+ | |||
+ | =====LAB #4 - sudo===== | ||
La commande **sudo** permet à un utilisateur autorisé d' | La commande **sudo** permet à un utilisateur autorisé d' | ||
Ligne 1385: | Ligne 1611: | ||
< | < | ||
- | [root@centos8 | + | root@debian11:~# cat / |
- | ## Sudoers allows particular users to run various commands as | + | # |
- | ## the root user, without needing | + | # This file MUST be edited with the ' |
- | ## | + | # |
- | ## Examples are provided at the bottom | + | # Please consider adding local content in / |
- | ## of related commands, which can then be delegated out to particular | + | # directly modifying this file. |
- | ## users or groups. | + | # |
- | ## | + | # See the man page for details on how to write a sudoers file. |
- | ## This file must be edited with the ' | + | # |
+ | Defaults | ||
+ | Defaults | ||
+ | Defaults | ||
- | ## Host Aliases | + | # Host alias specification |
- | ## Groups of machines. You may prefer to use hostnames (perhaps using | + | |
- | ## wildcards for entire domains) or IP addresses instead. | + | |
- | # Host_Alias | + | |
- | # Host_Alias | + | |
- | ## User Aliases | + | # User alias specification |
- | ## These aren't often necessary, as you can use regular groups | + | |
- | ## (ie, from files, LDAP, NIS, etc) in this file - just use %groupname | + | |
- | ## rather than USERALIAS | + | |
- | # User_Alias ADMINS = jsmith, mikem | + | |
+ | # Cmnd alias specification | ||
- | ## Command Aliases | + | # User privilege specification |
- | ## These are groups of related commands... | + | root ALL=(ALL: |
- | ## Networking | + | # Allow members of group sudo to execute any command |
- | # Cmnd_Alias NETWORKING | + | %sudo ALL=(ALL:ALL) ALL |
- | ## Installation and management of software | + | # See sudoers(5) for more information on " |
- | # Cmnd_Alias SOFTWARE = /bin/rpm, / | + | |
- | ## Services | + | @includedir |
- | # Cmnd_Alias SERVICES = /sbin/service, / | + | </code> |
- | ## Updating the locate database | + | <WRAP center round important> |
- | # Cmnd_Alias LOCATE | + | **Important** : Notez la présence de la ligne **%sudo |
+ | </WRAP> | ||
- | ## Storage | + | Devenez l' |
- | # Cmnd_Alias STORAGE = / | + | |
- | ## Delegating permissions | + | < |
- | # Cmnd_Alias DELEGATING = / | + | root@debian11: |
+ | logout | ||
+ | trainee@debian11: | ||
+ | </code> | ||
- | ## Processes | + | Saisissez la commande suivante : |
- | # Cmnd_Alias PROCESSES = /bin/nice, /bin/kill, / | + | |
- | ## Drivers | + | < |
- | # Cmnd_Alias DRIVERS = / | + | trainee@debian11: |
- | # Defaults specification | + | We trust you have received the usual lecture from the local System |
+ | Administrator. It usually boils down to these three things: | ||
- | # | + | |
- | # Refuse to run if unable to disable echo on the tty. | + | #2) Think before you type. |
- | # | + | #3) With great power comes great responsibility. |
- | Defaults | + | |
- | # | + | [sudo] password |
- | # Preserving HOME has security implications since many programs | + | </ |
- | # use it when searching | + | |
- | # is already set when the the env_reset option is enabled, so | + | |
- | # this option is only effective for configurations where either | + | |
- | # env_reset is disabled or HOME is present in the env_keep list. | + | |
- | # | + | |
- | Defaults | + | |
- | Defaults | + | |
- | # Prior to version 1.8.15, groups listed in sudoers that were not | + | Saisissez le mot de passe de **trainee** |
- | # found in the system group database were passed to the group | + | |
- | # plugin, if any. Starting with 1.8.15, only groups of the form | + | |
- | # %:group are resolved via the group plugin by default. | + | |
- | # We enable always_query_group_plugin to restore old behavior. | + | |
- | # Disable this option for new behavior. | + | |
- | Defaults | + | |
- | Defaults | + | < |
- | Defaults | + | [sudo] password for trainee: trainee |
- | Defaults | + | trainee is not in the sudoers file. This incident will be reported. |
- | Defaults | + | </ |
- | Defaults | + | |
- | Defaults | + | |
- | # | + | <WRAP center round important> |
- | # Adding HOME to env_keep may enable | + | **Important** : Notez que la commande |
- | # commands via sudo. | + | </ |
- | # | + | |
- | # Defaults | + | |
- | Defaults | + | Mettez maintenant l' |
- | ## Next comes the main part: which users can run what software on | + | < |
- | ## which machines (the sudoers file can be shared between multiple | + | trainee@debian11:~$ su - |
- | ## systems). | + | Password: fenestros |
- | ## Syntax: | + | |
- | ## | + | |
- | ## user MACHINE=COMMANDS | + | |
- | ## | + | |
- | ## The COMMANDS section may have other options added to it. | + | |
- | ## | + | |
- | ## Allow root to run any commands anywhere | + | |
- | root ALL=(ALL) ALL | + | |
- | ## Allows members of the ' | + | root@debian11: |
- | ## service management apps and more. | + | |
- | # %sys ALL = NETWORKING, SOFTWARE, SERVICES, STORAGE, DELEGATING, PROCESSES, LOCATE, DRIVERS | + | |
- | ## Allows people in group wheel to run all commands | + | root@debian11: |
- | %wheel ALL=(ALL) ALL | + | trainee : trainee cdrom floppy sudo audio dip video plugdev netdev lpadmin scanner |
- | ## Same thing without a password | + | root@debian11: |
- | # %wheel ALL=(ALL) NOPASSWD: | + | logout |
+ | </ | ||
- | ## Allows members of the users group to mount and unmount the | + | Constatez que vous ne faites pas parti du groupe **sudo** : |
- | ## cdrom as root | + | |
- | # %users | + | |
- | ## Allows members of the users group to shutdown this system | + | < |
- | # %users | + | trainee@debian11: |
+ | trainee cdrom floppy audio dip video plugdev netdev lpadmin scanner | ||
+ | </code> | ||
- | ## Read drop-in files from /etc/ | + | Rejoignez le groupe **sudo** : |
- | #includedir / | + | |
+ | < | ||
+ | trainee@debian11: | ||
+ | |||
+ | trainee@debian11: | ||
+ | sudo cdrom floppy audio dip video plugdev netdev lpadmin scanner trainee | ||
+ | </code> | ||
+ | |||
+ | Essayez de nouveau la commande sudo : | ||
+ | |||
+ | < | ||
+ | trainee@debian11: | ||
+ | [sudo] password for trainee: trainee | ||
+ | root@debian11: | ||
</ | </ | ||
- | <WRAP center round important | + | <WRAP center round important> |
- | **Important** : Notez la présence de la ligne **%wheel ALL=(ALL) ALL**. Cette ligne possède le format **Qui Où = (En tant que qui) Quoi**. La ligne implique donc que les membres du groupe **wheel** peuvent exécuter à partir de n' | + | **Important** : Notez que la commande |
</ | </ | ||
----- | ----- | ||
- | Copyright © 2022 Hugh Norris. | + | Copyright © 2024 Hugh Norris. |