{"id":2626,"date":"2025-11-29T17:44:56","date_gmt":"2025-11-29T16:44:56","guid":{"rendered":"https:\/\/artheodoc.fr\/?page_id=2626"},"modified":"2025-12-14T15:57:45","modified_gmt":"2025-12-14T14:57:45","slug":"la-gestion-des-droits-sous-linux-sticky-bit-sgid-suid","status":"publish","type":"page","link":"https:\/\/artheodoc.fr\/index.php\/la-gestion-des-droits-sous-linux-sticky-bit-sgid-suid\/","title":{"rendered":"La gestion des droits sous Linux (sticky bit &#8211; sgid &#8211; suid)"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">Le sticky bit<\/h1>\n\n\n\n<div class=\"wp-block-group has-pale-ocean-gradient-background has-background is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>Le sticky bit<\/strong> n\u2019est utilis\u00e9 que sur les r\u00e9pertoires. Quand il est activ\u00e9 , <strong>les utilisateurs ne peuvent plus supprimer ou renommer les fichiers qui y sont contenus<\/strong>. Quand il ne l\u2019est pas et que les utilisateurs ont une autorisation en \u00e9criture sur le r\u00e9pertoire, ils peuvent en supprimer et en renommer tous les fichiers.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Le sticky bit peut \u00eatre activ\u00e9 en utilisant une syntaxe num\u00e9rique ou alphanum\u00e9rique.<\/li>\n\n\n\n<li>L\u2019activation du sticki bit peut \u00eatre signal\u00e9e par un <strong>t<\/strong> ou un <strong>T<\/strong>.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<p>Exemple avec le dossier tmp&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l \/ | grep tmp<\/strong><br>drwxrwxrw<strong>t<\/strong>  17 root root       4096 nov.  28 18:04 tmp<\/pre>\n\n\n\n<p>Le sticky bit peut \u00eatre activ\u00e9 en utilisant une syntaxe num\u00e9rique ou alphanum\u00e9rique&nbsp;:<\/p>\n\n\n\n<p>Pour l\u2019activer&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod +t mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxrwxr-<strong>t<\/strong> 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<p>Pour le d\u00e9sactiver&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod -t mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxrwxr-x 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<p>Pour l\u2019activer&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod 1775 mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxrwxr-<strong>t<\/strong> 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<p>Pour le d\u00e9sactiver&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod 0775 mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxrwxr-x 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">sgid<\/h1>\n\n\n\n<div class=\"wp-block-group has-pale-ocean-gradient-background has-background is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>sgid<\/strong> peut s\u2019appliquer aux fichiers et aux r\u00e9pertoires. Un utilisateur peut ex\u00e9cuter un fichier avec les permissions du groupe \u00e0 la place de celles du propri\u00e9taire.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Lorqu\u2019elle est appliqu\u00e9e \u00e0 des r\u00e9pertoires , <strong>tous les fichiers cr\u00e9\u00e9s dans ce r\u00e9pertoire appartiennent au groupe assign\u00e9 au r\u00e9pertoire<\/strong>.<\/li>\n\n\n\n<li>Le sgid peut \u00eatre activ\u00e9 en utilisant une syntaxe num\u00e9rique ou alphanum\u00e9rique.<\/li>\n<\/ul>\n<\/div>\n\n\n\n<p>Pour l\u2019activer&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod g+s mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxrw<strong>s<\/strong>r-x 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<p>Pour le d\u00e9sactiver&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod g-s mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxrwxr-x 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<p>Pour l\u2019activer&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod 2755 mon_repertoire<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>drwxr-<strong>s<\/strong>r-x 2 dominique dominique 4096 nov.  28 18:12 mon_repertoire<\/pre>\n\n\n\n<p>Pour le d\u00e9sactiver&nbsp;la commande <strong>chmod 0755 mon_repertoire<\/strong> n&rsquo;a pas fonctionn\u00e9 quand je l&rsquo;ai test\u00e9e sous Linux Mint et Debian.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">suid<\/h1>\n\n\n\n<div class=\"wp-block-group has-pale-ocean-gradient-background has-background is-layout-constrained wp-block-group-is-layout-constrained\">\n<p><strong>suid<\/strong> ne s\u2019applique qu\u2019aux fichiers ex\u00e9cutables et pas aux r\u00e9pertoires.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Lorsque suid est activ\u00e9, <strong>un utilisateur peut ex\u00e9cuter un fichier avec les permissions du propri\u00e9taire<\/strong>.<\/li>\n\n\n\n<li>Le suid peut \u00eatre activ\u00e9 en utilisant une syntaxe num\u00e9rique ou alphanum\u00e9rique&nbsp;:<\/li>\n<\/ul>\n<\/div>\n\n\n\n<p>Exemple avec passwd&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l \/usr\/bin\/passwd<\/strong><br>-rw<strong>s<\/strong>r-xr-x 1 root root 64152 mai   30  2024 \/usr\/bin\/passwd<\/pre>\n\n\n\n<p>Le suid peut \u00eatre activ\u00e9 en utilisant une syntaxe num\u00e9rique ou alphanum\u00e9rique&nbsp;:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod u+s mon_fichier<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>-rw<strong>S<\/strong>rw-r-- 1 dominique dominique    0 nov.  28 18:37 mon_fichier<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod u-s mon_fichier<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>-rw-rw-r-- 1 dominique dominique    0 nov.  28 18:37 mon_fichier<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod 4754 mon_fichier<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>-rw<strong>s<\/strong>r-xr-- 1 dominique dominique    0 nov.  28 18:37 mon_fichier<\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>chmod 0754 mon_fichier<\/strong><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>ls -l<\/strong><br>-rwxr-xr-- 1 dominique dominique    0 nov.  28 18:37 mon_fichier<\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Plus d\u2019informations<\/h1>\n\n\n\n<p>Activations et d\u00e9sactivations en num\u00e9rique.<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table class=\"has-fixed-layout\"><tbody><tr><td><strong>0<\/strong><\/td><td>Supprime le sticky bit et suid<\/td><\/tr><tr><td><strong>1<\/strong><\/td><td>Active le sticky bit<\/td><\/tr><tr><td><strong>2<\/strong><\/td><td>Active sgid<\/td><\/tr><tr><td><strong>3<\/strong><\/td><td>Active le sticky bit et sgid<\/td><\/tr><tr><td><strong>4<\/strong><\/td><td>Active suid<\/td><\/tr><tr><td><strong>5<\/strong><\/td><td>Active le sticky bit et suid<\/td><\/tr><tr><td><strong>6<\/strong><\/td><td>Active sgid et suid<\/td><\/tr><tr><td><strong>7<\/strong><\/td><td>Active le sticky bit, sgid et suid<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><em>La d\u00e9sactivation ne fonctionne pas toujours en num\u00e9rique.<\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">Voir \u00e9galement<\/h1>\n\n\n\n<p><a href=\"https:\/\/artheodoc.fr\/index.php\/ls-lister-les-fichiers-et-dossiers-dans-un-repertoire-sous-linux\/\" data-type=\"page\" data-id=\"2695\" target=\"_blank\" rel=\"noreferrer noopener\">Ls \u2013 Lister les fichiers et dossiers dans un r\u00e9pertoire sous Linux<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/artheodoc.fr\/index.php\/chmod-les-bases-des-permissions\/\" data-type=\"page\" data-id=\"2678\" target=\"_blank\" rel=\"noreferrer noopener\">Chmod \u2013 Les bases des permissions<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/artheodoc.fr\/index.php\/la-creation-et-la-suppression-des-utilisateurs-et-des-groupes-avec-les-commandes-shell-linux\/\" data-type=\"page\" data-id=\"2683\" target=\"_blank\" rel=\"noreferrer noopener\">La cr\u00e9ation et la suppression des utilisateurs et des groupes avec les commandes Shell Linux<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/artheodoc.fr\/index.php\/modifier-les-proprietes-dun-compte-utilisateur-avec-usermod-sous-linux\/\" data-type=\"page\" data-id=\"2687\" target=\"_blank\" rel=\"noreferrer noopener\">Modifier les propri\u00e9t\u00e9s d\u2019un compte utilisateur avec usermod sous Linux<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/artheodoc.fr\/index.php\/modifier-le-proprietaire-et-ou-le-groupe-proprietaire-dun-fichier-ou-repertoire-avec-chgrp-et-chown-sous-linux\/\" data-type=\"page\" data-id=\"2691\" target=\"_blank\" rel=\"noreferrer noopener\">Modifier le propri\u00e9taire et\/ou le groupe propri\u00e9taire d\u2019un fichier ou r\u00e9pertoire avec chgrp et chown sous Linux<\/a><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Le sticky bit Le sticky bit n\u2019est utilis\u00e9 que sur les r\u00e9pertoires. Quand il est activ\u00e9 , les utilisateurs ne peuvent plus supprimer ou renommer les fichiers qui y sont contenus. Quand il ne l\u2019est pas et que les utilisateurs ont une autorisation en \u00e9criture sur le r\u00e9pertoire, ils peuvent en supprimer et en renommer [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"class_list":["post-2626","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages\/2626","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/comments?post=2626"}],"version-history":[{"count":3,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages\/2626\/revisions"}],"predecessor-version":[{"id":2702,"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/pages\/2626\/revisions\/2702"}],"wp:attachment":[{"href":"https:\/\/artheodoc.fr\/index.php\/wp-json\/wp\/v2\/media?parent=2626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}