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:lpic:11:500:l104 [2023/06/09 12:11] – admin | elearning:workbooks:lpic:11:500:l104 [2024/04/05 08:03] (Version actuelle) – admin | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
~~PDF: | ~~PDF: | ||
- | Version : **2023.01** | + | Version : **2024.01** |
Dernière mise-à-jour : ~~LASTMOD~~ | Dernière mise-à-jour : ~~LASTMOD~~ | ||
Ligne 3628: | Ligne 3628: | ||
lsattr: invalid option -- ' | lsattr: invalid option -- ' | ||
Usage: lsattr [-RVadlv] [files...] | Usage: lsattr [-RVadlv] [files...] | ||
+ | </ | ||
+ | |||
+ | =====Rôle du noyau===== | ||
+ | |||
+ | Le noyau ou //kernel// est la partie du système d' | ||
+ | |||
+ | * la diminution de la taille du noyau, | ||
+ | * la prise en charge de nouveau matériel, | ||
+ | * l' | ||
+ | * l' | ||
+ | * la correction de bogues, | ||
+ | * le besoin d'une fonctionnalité expérimentale. | ||
+ | |||
+ | Commencez par identifier le noyau utilisé par votre machine : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# uname -r | ||
+ | 3.10.0-327.13.1.el7.x86_64 | ||
+ | </ | ||
+ | |||
+ | Dans le cas d'une utilisation courante de Linux, il est cependant préférable de faire appel aux **modules**. Les modules se trouvent dans le répertoire **/ | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# ls / | ||
+ | build | ||
+ | extra | ||
+ | kernel | ||
+ | </ | ||
+ | |||
+ | Les commandes pour manipuler les modules sont : | ||
+ | |||
+ | * insmod | ||
+ | * rmmod | ||
+ | * lsmod | ||
+ | * modprobe | ||
+ | |||
+ | Par exemple : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# lsmod | ||
+ | Module | ||
+ | ip6t_rpfilter | ||
+ | ip6t_REJECT | ||
+ | ipt_REJECT | ||
+ | xt_conntrack | ||
+ | ebtable_nat | ||
+ | ebtable_broute | ||
+ | bridge | ||
+ | stp 12976 1 bridge | ||
+ | llc 14552 2 stp,bridge | ||
+ | ebtable_filter | ||
+ | ebtables | ||
+ | ip6table_nat | ||
+ | nf_conntrack_ipv6 | ||
+ | nf_defrag_ipv6 | ||
+ | nf_nat_ipv6 | ||
+ | ip6table_mangle | ||
+ | ip6table_security | ||
+ | ip6table_raw | ||
+ | ip6table_filter | ||
+ | ip6_tables | ||
+ | iptable_nat | ||
+ | nf_conntrack_ipv4 | ||
+ | nf_defrag_ipv4 | ||
+ | nf_nat_ipv4 | ||
+ | nf_nat | ||
+ | nf_conntrack | ||
+ | iptable_mangle | ||
+ | iptable_security | ||
+ | iptable_raw | ||
+ | iptable_filter | ||
+ | dm_mirror | ||
+ | dm_region_hash | ||
+ | dm_log | ||
+ | dm_mod | ||
+ | crc32_pclmul | ||
+ | ghash_clmulni_intel | ||
+ | aesni_intel | ||
+ | lrw 13286 1 aesni_intel | ||
+ | gf128mul | ||
+ | glue_helper | ||
+ | snd_intel8x0 | ||
+ | ablk_helper | ||
+ | cryptd | ||
+ | snd_ac97_codec | ||
+ | ac97_bus | ||
+ | ppdev 17671 0 | ||
+ | snd_seq | ||
+ | snd_seq_device | ||
+ | snd_pcm | ||
+ | pcspkr | ||
+ | sg | ||
+ | parport_pc | ||
+ | parport | ||
+ | snd_timer | ||
+ | snd 83425 8 snd_ac97_codec, | ||
+ | soundcore | ||
+ | i2c_piix4 | ||
+ | video 24400 0 | ||
+ | i2c_core | ||
+ | nfsd 302418 | ||
+ | auth_rpcgss | ||
+ | nfs_acl | ||
+ | lockd 93600 1 nfsd | ||
+ | grace 13295 2 nfsd,lockd | ||
+ | sunrpc | ||
+ | ip_tables | ||
+ | xfs | ||
+ | libcrc32c | ||
+ | sd_mod | ||
+ | crc_t10dif | ||
+ | crct10dif_generic | ||
+ | sr_mod | ||
+ | cdrom 42556 1 sr_mod | ||
+ | ata_generic | ||
+ | pata_acpi | ||
+ | ahci | ||
+ | libahci | ||
+ | ata_piix | ||
+ | crct10dif_pclmul | ||
+ | crct10dif_common | ||
+ | crc32c_intel | ||
+ | serio_raw | ||
+ | libata | ||
+ | e1000 | ||
+ | </ | ||
+ | |||
+ | Pour ajouter un module, on peut utiliser la commande **insmod** ou **modprobe**. Cette dernière ajoute non seulement le module passé en argument mais également ses dépendances : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# modprobe bonding | ||
+ | [root@centos7 ~]# lsmod | more | ||
+ | Module | ||
+ | bonding | ||
+ | ip6t_rpfilter | ||
+ | ip6t_REJECT | ||
+ | ipt_REJECT | ||
+ | xt_conntrack | ||
+ | ebtable_nat | ||
+ | ebtable_broute | ||
+ | bridge | ||
+ | stp 12976 1 bridge | ||
+ | llc 14552 2 stp,bridge | ||
+ | ebtable_filter | ||
+ | ebtables | ||
+ | ip6table_nat | ||
+ | nf_conntrack_ipv6 | ||
+ | nf_defrag_ipv6 | ||
+ | nf_nat_ipv6 | ||
+ | ip6table_mangle | ||
+ | ip6table_security | ||
+ | ip6table_raw | ||
+ | ip6table_filter | ||
+ | ip6_tables | ||
+ | y, | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | Pour supprimer un module, on peut utiliser la commande **rmmod** ou **modprobe -r**. Cette dernière essaie de supprimer les dépendances non-utilisées : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# modprobe -r bonding | ||
+ | [root@centos7 ~]# lsmod | more | ||
+ | Module | ||
+ | ip6t_rpfilter | ||
+ | ip6t_REJECT | ||
+ | ipt_REJECT | ||
+ | xt_conntrack | ||
+ | ebtable_nat | ||
+ | ebtable_broute | ||
+ | bridge | ||
+ | stp 12976 1 bridge | ||
+ | llc 14552 2 stp,bridge | ||
+ | ebtable_filter | ||
+ | ebtables | ||
+ | ip6table_nat | ||
+ | nf_conntrack_ipv6 | ||
+ | nf_defrag_ipv6 | ||
+ | nf_nat_ipv6 | ||
+ | ip6table_mangle | ||
+ | ip6table_security | ||
+ | ip6table_raw | ||
+ | ip6table_filter | ||
+ | ip6_tables | ||
+ | y, | ||
+ | iptable_nat | ||
+ | --More-- | ||
+ | </ | ||
+ | |||
+ | Les dépendances des modules sont résolues par la commande **modprobe** grâce aux fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# more / | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | to/lrw.ko kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | el/ | ||
+ | kernel/ | ||
+ | helper.ko kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | kernel/ | ||
+ | f128mul.ko kernel/ | ||
+ | kernel/ | ||
+ | --More--(0%) | ||
+ | </ | ||
+ | |||
+ | Il est possible d' | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# modinfo bonding | ||
+ | filename: | ||
+ | author: | ||
+ | description: | ||
+ | version: | ||
+ | license: | ||
+ | alias: | ||
+ | rhelversion: | ||
+ | srcversion: | ||
+ | depends: | ||
+ | intree: | ||
+ | vermagic: | ||
+ | signer: | ||
+ | sig_key: | ||
+ | sig_hashalgo: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | parm: | ||
+ | </ | ||
+ | |||
+ | Dernièrement, | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# ls / | ||
+ | mlx4.conf | ||
+ | |||
+ | [root@centos7 ~]# cat / | ||
+ | # This file is intended for users to select the various module options | ||
+ | # they need for the mlx4 driver. | ||
+ | # any user made changes to this file are preserved. | ||
+ | # to the libmlx4.conf file in this directory are overwritten on | ||
+ | # pacakge upgrade. | ||
+ | # | ||
+ | # Some sample options and what they would do | ||
+ | # Enable debugging output, device managed flow control, and disable SRIOV | ||
+ | #options mlx4_core debug_level=1 log_num_mgm_entry_size=-1 probe_vf=0 num_vfs=0 | ||
+ | # | ||
+ | # Enable debugging output and create SRIOV devices, but don't attach any of | ||
+ | # the child devices to the host, only the parent device | ||
+ | #options mlx4_core debug_level=1 probe_vf=0 num_vfs=7 | ||
+ | # | ||
+ | # Enable debugging output, SRIOV, and attach one of the SRIOV child devices | ||
+ | # in addition to the parent device to the host | ||
+ | #options mlx4_core debug_level=1 probe_vf=1 num_vfs=7 | ||
+ | # | ||
+ | # Enable per priority flow control for send and receive, setting both priority | ||
+ | # 1 and 2 as no drop priorities | ||
+ | #options mlx4_en pfctx=3 pfcrx=3 | ||
+ | </ | ||
+ | |||
+ | =====Gestion des Quotas===== | ||
+ | |||
+ | Sous Linux il est possible de mettre en place des quotas par utilisateur et par groupe. Ceci étant, Linux ne sait pas gérer des quotas par répertoire, | ||
+ | quotas par partition. L' | ||
+ | |||
+ | Déconnectez-vous et reconnectez-vous en tant que root. | ||
+ | |||
+ | Avant de mettre en place des quotas, configurer SELINUX en mode **permissive** afin de ne pas avoir d' | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# getenforce | ||
+ | Enforcing | ||
+ | [root@centos7 ~]# setenforce permissive | ||
+ | [root@centos7 ~]# getenforce | ||
+ | Permissive | ||
+ | </ | ||
+ | |||
+ | Editez ensuite le fichier / | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# vi / | ||
+ | [root@centos7 ~]# cat / | ||
+ | |||
+ | # This file controls the state of SELinux on the system. | ||
+ | # SELINUX= can take one of these three values: | ||
+ | # | ||
+ | # | ||
+ | # | ||
+ | SELINUX=permissive | ||
+ | # SELINUXTYPE= can take one of three two values: | ||
+ | # | ||
+ | # | ||
+ | # mls - Multi Level Security protection. | ||
+ | SELINUXTYPE=targeted | ||
+ | </ | ||
+ | |||
+ | ====Déplacer /home==== | ||
+ | |||
+ | Créez une seule partition sur **/ | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# fdisk /dev/sdb | ||
+ | Welcome to fdisk (util-linux 2.23.2). | ||
+ | |||
+ | Changes will remain in memory only, until you decide to write them. | ||
+ | Be careful before using the write command. | ||
+ | |||
+ | Device does not contain a recognized partition table | ||
+ | Building a new DOS disklabel with disk identifier 0x88708329. | ||
+ | |||
+ | Command (m for help): n | ||
+ | Partition type: | ||
+ | | ||
+ | | ||
+ | Select (default p): p | ||
+ | Partition number (1-4, default 1): | ||
+ | First sector (2048-41943039, | ||
+ | Using default value 2048 | ||
+ | Last sector, +sectors or +size{K, | ||
+ | Using default value 41943039 | ||
+ | Partition 1 of type Linux and of size 20 GiB is set | ||
+ | |||
+ | Command (m for help): w | ||
+ | The partition table has been altered! | ||
+ | |||
+ | Calling ioctl() to re-read partition table. | ||
+ | Syncing disks. | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un système de fichiers ext4 sur **/ | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# mkfs.ext4 /dev/sdb1 | ||
+ | mke2fs 1.42.9 (28-Dec-2013) | ||
+ | Filesystem label= | ||
+ | OS type: Linux | ||
+ | Block size=4096 (log=2) | ||
+ | Fragment size=4096 (log=2) | ||
+ | Stride=0 blocks, Stripe width=0 blocks | ||
+ | 1310720 inodes, 5242624 blocks | ||
+ | 262131 blocks (5.00%) reserved for the super user | ||
+ | First data block=0 | ||
+ | Maximum filesystem blocks=2153775104 | ||
+ | 160 block groups | ||
+ | 32768 blocks per group, 32768 fragments per group | ||
+ | 8192 inodes per group | ||
+ | Superblock backups stored on blocks: | ||
+ | 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, | ||
+ | 4096000 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (32768 blocks): done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | |||
+ | Montez **/ | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# mount /dev/sdb1 /mnt | ||
+ | </ | ||
+ | |||
+ | Copiez le contenu de /home vers /mnt : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# cp -a /home/* /mnt | ||
+ | </ | ||
+ | |||
+ | Démontez /dev/sdb1 et déplacez /home vers /root : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# umount /mnt | ||
+ | [root@centos7 ~]# mv /home /root | ||
+ | </ | ||
+ | |||
+ | Identifiez l'UUID de /dev/sdb1 : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# ls -l / | ||
+ | lrwxrwxrwx. 1 root root 10 9 août 06:47 a5e2457f-7337-41f4-b958-e403eb419f94 -> ../../sdb1 | ||
+ | </ | ||
+ | |||
+ | Editez le fichier **/ | ||
+ | |||
+ | <file txt / | ||
+ | # | ||
+ | # /etc/fstab | ||
+ | # Created by anaconda on Sat Apr 30 11:27:02 2016 | ||
+ | # | ||
+ | # Accessible filesystems, | ||
+ | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info | ||
+ | # | ||
+ | UUID=e65fe7da-cda8-4f5a-a827-1b5cabe94bed / | ||
+ | UUID=2d947276-66e8-41f4-8475-b64b67d7a249 /boot | ||
+ | UUID=3181601a-7295-4ef0-a92c-f21f76b18e64 swap swap defaults | ||
+ | UUID=a5e2457f-7337-41f4-b958-e403eb419f94 / | ||
+ | |||
+ | </ | ||
+ | |||
+ | Créez le point de montage /home : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# mkdir /home | ||
+ | </ | ||
+ | |||
+ | Montez /dev/sdb1 : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# mount -a | ||
+ | [root@centos7 ~]# mount | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | proc on /proc type proc (rw, | ||
+ | devtmpfs on /dev type devtmpfs (rw, | ||
+ | securityfs on / | ||
+ | tmpfs on /dev/shm type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | tmpfs on /run type tmpfs (rw, | ||
+ | tmpfs on / | ||
+ | cgroup on / | ||
+ | pstore on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | cgroup on / | ||
+ | configfs on / | ||
+ | /dev/sda2 on / type xfs (rw, | ||
+ | selinuxfs on / | ||
+ | systemd-1 on / | ||
+ | debugfs on / | ||
+ | hugetlbfs on / | ||
+ | mqueue on /dev/mqueue type mqueue (rw, | ||
+ | tmpfs on /tmp type tmpfs (rw, | ||
+ | sunrpc on / | ||
+ | nfsd on / | ||
+ | /dev/sda1 on /boot type xfs (rw, | ||
+ | /dev/sdb1 on /home type ext4 (rw, | ||
+ | tmpfs on / | ||
+ | </ | ||
+ | |||
+ | Notez la taille de /home : | ||
+ | |||
+ | < | ||
+ | [trainee@centos7 ~]$ df -h | ||
+ | Sys. de fichiers Taille Utilisé Dispo Uti% Monté sur | ||
+ | / | ||
+ | devtmpfs | ||
+ | tmpfs 245M | ||
+ | tmpfs 245M 4,7M 240M 2% /run | ||
+ | tmpfs 245M | ||
+ | tmpfs 245M | ||
+ | / | ||
+ | / | ||
+ | tmpfs | ||
+ | </ | ||
+ | |||
+ | <WRAP center round todo> | ||
+ | Fermez la session de root et connectez-vous en tant que trainee. | ||
+ | </ | ||
+ | |||
+ | ====Mettre en Place des Quotas==== | ||
+ | |||
+ | Commencez par vérifiez que le paquet **quota** est bien installé : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# rpm -qa | grep quota | ||
+ | quota-4.01-11.el7_2.1.x86_64 | ||
+ | quota-nls-4.01-11.el7_2.1.noarch | ||
+ | </ | ||
+ | |||
+ | Editez le fichier **/ | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# vi /etc/fstab | ||
+ | [root@centos7 ~]# cat /etc/fstab | ||
+ | |||
+ | # | ||
+ | # /etc/fstab | ||
+ | # Created by anaconda on Sat Apr 30 11:27:02 2016 | ||
+ | # | ||
+ | # Accessible filesystems, | ||
+ | # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info | ||
+ | # | ||
+ | UUID=e65fe7da-cda8-4f5a-a827-1b5cabe94bed / | ||
+ | UUID=2d947276-66e8-41f4-8475-b64b67d7a249 /boot | ||
+ | UUID=3181601a-7295-4ef0-a92c-f21f76b18e64 swap swap defaults | ||
+ | UUID=a080ac6a-d15c-48e2-8461-a7b1aa3ebf1a / | ||
+ | </ | ||
+ | |||
+ | Démontez puis remontez /home : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# umount /home | ||
+ | [root@centos7 ~]# mount -a | ||
+ | </ | ||
+ | |||
+ | Déconnectez-vous et reconnectez-vous en tant que trainee. Vérifiez ensuite que les options soient prises en compte : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# cat /etc/mtab | ||
+ | rootfs / rootfs rw 0 0 | ||
+ | sysfs /sys sysfs rw, | ||
+ | proc /proc proc rw, | ||
+ | devtmpfs /dev devtmpfs rw, | ||
+ | securityfs / | ||
+ | tmpfs /dev/shm tmpfs rw, | ||
+ | devpts /dev/pts devpts rw, | ||
+ | tmpfs /run tmpfs rw, | ||
+ | tmpfs / | ||
+ | cgroup / | ||
+ | pstore / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | cgroup / | ||
+ | configfs / | ||
+ | /dev/sda2 / xfs rw, | ||
+ | selinuxfs / | ||
+ | systemd-1 / | ||
+ | debugfs / | ||
+ | hugetlbfs / | ||
+ | tmpfs /tmp tmpfs rw,seclabel 0 0 | ||
+ | mqueue /dev/mqueue mqueue rw, | ||
+ | sunrpc / | ||
+ | nfsd / | ||
+ | /dev/sda1 /boot xfs rw, | ||
+ | tmpfs /run/user/0 tmpfs rw, | ||
+ | /dev/sdb1 /home ext4 rw, | ||
+ | </ | ||
+ | |||
+ | ====La Commande quotacheck==== | ||
+ | |||
+ | Pour activer les quotas sur /home, il convient d' | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# quotacheck -cugvm -f /dev/sdb1 | ||
+ | quotacheck: Your kernel probably supports journaled quota but you are not using it. Consider switching to journaled quota to avoid running quotacheck after an unclean shutdown. | ||
+ | quotacheck: Parcours de /dev/sdb1 [/home] terminé | ||
+ | quotacheck: Cannot stat old user quota file / | ||
+ | quotacheck: Cannot stat old group quota file / | ||
+ | quotacheck: Cannot stat old user quota file / | ||
+ | quotacheck: Cannot stat old group quota file / | ||
+ | quotacheck: Vérifié 100 répertoires et 230 fichiers | ||
+ | quotacheck: Ancien fichier non trouvé. | ||
+ | quotacheck: Ancien fichier non trouvé. | ||
+ | </ | ||
+ | |||
+ | Les options de la commande quotacheck sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# quotacheck --help | ||
+ | Utility for checking and repairing quota files. | ||
+ | quotacheck [-gucbfinvdmMR] [-F < | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -c, --create-files | ||
+ | -b, --backup | ||
+ | -f, --force | ||
+ | -i, --interactive | ||
+ | -n, --use-first-dquot | ||
+ | -v, --verbose | ||
+ | -d, --debug | ||
+ | -m, --no-remount | ||
+ | -M, --try-remount | ||
+ | continue even if it fails | ||
+ | -R, --exclude-root | ||
+ | -F, --format=formatname | ||
+ | -a, --all check all filesystems | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Rapports de bugs à jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | Les quotas ont été activés et les fichier **aquota.user** et **aquota.group** ont été créés dans le répertoire /home : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# ls -la /home | ||
+ | total 44 | ||
+ | drwxr-xr-x. | ||
+ | dr-xr-xr-x. 18 root root 4096 11 août 13:27 .. | ||
+ | -rw-------. | ||
+ | -rw-------. | ||
+ | drwx------. | ||
+ | drwx------. 14 trainee trainee | ||
+ | </ | ||
+ | |||
+ | Créez maintenant un utilisateur **fenestros** avec le mot de passe **fenestros** : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# groupadd fenestros && useradd fenestros -c FenestrOs -d / | ||
+ | [root@centos7 ~]# passwd fenestros | ||
+ | Changement de mot de passe pour l' | ||
+ | Nouveau mot de passe : fenestros | ||
+ | MOT DE PASSE INCORRECT : Le mot de passe contient le nom d' | ||
+ | Retapez le nouveau mot de passe : fenestros | ||
+ | passwd : mise à jour réussie de tous les jetons d' | ||
+ | [root@centos7 ~]# | ||
+ | </ | ||
+ | |||
+ | ====La Commande edquota==== | ||
+ | |||
+ | Mettez en place maintenant un quota de 10Mo pour l' | ||
+ | |||
+ | < | ||
+ | [root@centos ~]# edquota -u fenestros -f /home | ||
+ | </ | ||
+ | |||
+ | L' | ||
+ | |||
+ | < | ||
+ | Quotas disque pour user fenestros (uid 1001) : | ||
+ | | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Modifiez ce fichier ainsi : | ||
+ | |||
+ | < | ||
+ | Quotas disque pour user fenestros (uid 1001) : | ||
+ | | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **edquota** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# edquota --help | ||
+ | edquota: Usage: | ||
+ | edquota [-rm] [-u] [-F formatname] [-p username] [-f filesystem] username ... | ||
+ | edquota [-rm] -g [-F formatname] [-p groupname] [-f filesystem] groupname ... | ||
+ | edquota [-u|g] [-F formatname] [-f filesystem] -t | ||
+ | edquota [-u|g] [-F formatname] [-f filesystem] -T username|groupname ... | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -r, --remote | ||
+ | -m, --no-mixed-pathnames | ||
+ | -F, --format=formatname | ||
+ | -p, --prototype=name | ||
+ | --always-resolve | ||
+ | composed only of digits | ||
+ | -f, --filesystem=filesystem | ||
+ | -t, --edit-period | ||
+ | -T, --edit-times | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Rapports de bugs à : jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Pour mettre en place un quota par group, la procédure est similaire. Il suffit d' | ||
+ | </ | ||
+ | |||
+ | ====La Commande quotaon==== | ||
+ | |||
+ | Appliquez maintenant les quotas : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# quotaon -a | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **quotaon** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# quotaon --help | ||
+ | quotaon: Usage: | ||
+ | quotaon [-guvp] [-F quotaformat] [-x state] -a | ||
+ | quotaon [-guvp] [-F quotaformat] [-x state] filesys ... | ||
+ | |||
+ | -a, --all turn quotas on for all filesystems | ||
+ | -f, --off turn quotas off | ||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -p, --print-state | ||
+ | -x, --xfs-command=cmd | ||
+ | -F, --format=formatname | ||
+ | -v, --verbose | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | </ | ||
+ | |||
+ | De cette manière vous avez mis en place un quota **souple** pour fenestros de 8 000 Ko et un quota **stricte** de 10 000 Ko. | ||
+ | |||
+ | Quand l' | ||
+ | |||
+ | Il est à noter que vous pouvez soit mettre en place un quota en taille, soit mettre en place un quota basé sur le nombre d' | ||
+ | |||
+ | <WRAP center round important> | ||
+ | La commande pour désactivez les quotas est **quotaoff**. | ||
+ | </ | ||
+ | |||
+ | ====La Commande repquota==== | ||
+ | |||
+ | Pour visualiser les quotas utilisez la commande **repquota** : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# repquota /home | ||
+ | *** Rapport pour les quotas user sur le périphérique /dev/sdb1 | ||
+ | Période de sursis bloc : 7days ; période de sursis inode : 7days | ||
+ | Block limits | ||
+ | Utilisateur | ||
+ | ---------------------------------------------------------------------- | ||
+ | root -- 20 | ||
+ | trainee | ||
+ | |||
+ | </ | ||
+ | |||
+ | <WRAP center round important> | ||
+ | Notez que l' | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **repquota** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# repquota --help | ||
+ | repquota: Utility for reporting quotas. | ||
+ | Usage: | ||
+ | repquota [-vugsi] [-c|C] [-t|n] [-F quotaformat] (-a | mntpoint) | ||
+ | |||
+ | -v, --verbose | ||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -s, --human-readable | ||
+ | -t, --truncate-names | ||
+ | -p, --raw-grace | ||
+ | -n, --no-names | ||
+ | -i, --no-autofs | ||
+ | -c, --cache | ||
+ | -C, --no-cache | ||
+ | -F, --format=formatname | ||
+ | -a, --all | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Rapports de bugs à jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | ====La Commande quota==== | ||
+ | |||
+ | Pour visualiser les quotas d'un utilisateur spécifique, | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# quota fenestros | ||
+ | Disk quotas for user fenestros (uid 1001): aucun | ||
+ | [root@centos7 ~]# su - fenestros | ||
+ | [fenestros@centos7 ~]$ touch test | ||
+ | [fenestros@centos7 ~]$ exit | ||
+ | logout | ||
+ | [root@centos7 ~]# quota fenestros | ||
+ | Disk quotas for user fenestros (uid 1001): | ||
+ | Système fichiers | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **quota** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# quota --help | ||
+ | quota: Usage: quota [-guqvswim] [-l | [-Q | -A]] [-F quotaformat] | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -u username ... | ||
+ | quota [-qvswim] [-l | [-Q | -A]] [-F quotaformat] -g groupname ... | ||
+ | quota [-qvswugQm] [-F quotaformat] -f filesystem ... | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -q, --quiet | ||
+ | -v, --verbose | ||
+ | -s, --human-readable | ||
+ | --always-resolve | ||
+ | composed of only digits | ||
+ | -w, --no-wrap | ||
+ | -p, --raw-grace | ||
+ | -l, --local-only | ||
+ | -Q, --quiet-refuse | ||
+ | not respond | ||
+ | -i, --no-autofs | ||
+ | -F, --format=formatname | ||
+ | -f, --filesystem-list | ||
+ | -A, --all-nfs | ||
+ | -m, --no-mixed-pathnames | ||
+ | --show-mntpoint | ||
+ | --hide-device | ||
+ | -h, --help | ||
+ | -V, --version | ||
+ | |||
+ | Rapports de bugs à : jack@suse.cz | ||
+ | </ | ||
+ | |||
+ | ====La Commande warnquota==== | ||
+ | |||
+ | La commande **warnquota** vérifie le ou les disques et envoie un message par mail à tout utilisateur qui a dépassé la limite soft. Elle est enrègle générale appelée par un job cron. Cependant elle peut aussi est appelée d'une manière intéractive. | ||
+ | |||
+ | Sous RHEL/CentOS 7, warnquota n'est pas installé par défaut : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# yum install quota-warnquota | ||
+ | Modules complémentaires chargés : fastestmirror, | ||
+ | base | 3.6 kB 00: | ||
+ | extras | ||
+ | updates | ||
+ | Loading mirror speeds from cached hostfile | ||
+ | * base: centos.quelquesmots.fr | ||
+ | * extras: miroir.univ-paris13.fr | ||
+ | * updates: miroir.univ-paris13.fr | ||
+ | Résolution des dépendances | ||
+ | --> Lancement de la transaction de test | ||
+ | ---> Le paquet quota-warnquota.x86_64 1: | ||
+ | --> Résolution des dépendances terminée | ||
+ | |||
+ | Dépendances résolues | ||
+ | |||
+ | ======================================================================================================================================================================== | ||
+ | | ||
+ | ======================================================================================================================================================================== | ||
+ | Installation : | ||
+ | | ||
+ | |||
+ | Résumé de la transaction | ||
+ | ======================================================================================================================================================================== | ||
+ | Installation | ||
+ | |||
+ | Taille totale des téléchargements : 76 k | ||
+ | Taille d' | ||
+ | Is this ok [y/d/N]: y | ||
+ | </ | ||
+ | |||
+ | Les options de la commande **warnquota** sont : | ||
+ | |||
+ | < | ||
+ | [root@centos7 ~]# warnquota --help | ||
+ | warnquota: Usage: | ||
+ | warnquota [-ugsid] [-F quotaformat] [-c configfile] [-q quotatabfile] [-a adminsfile] [filesystem...] | ||
+ | |||
+ | -u, --user | ||
+ | -g, --group | ||
+ | -s, --human-readable | ||
+ | -i, --no-autofs | ||
+ | -d, --no-details | ||
+ | -F, --format=formatname | ||
+ | -c, --config=config-file | ||
+ | -q, --quota-tab=quotatab-file | ||
+ | -a, --admins-file=admins-file | ||
+ | -h, --help | ||
+ | -v, --version | ||
+ | |||
+ | Rapports de bugs à jack@suse.cz | ||
</ | </ | ||
----- | ----- | ||
- | Copyright © 2023 Hugh Norris. | + | Copyright © 2024 Hugh Norris. |