[lkml]   [2013]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectchown: s-Bits: to clear or not to clear
Hi folks,

I discovered (SLES11 SP2 with kernel 3.0.80) that a chown executed by root (from non-root to non-root user) clears any s-Bits that were set for the old owner.

The man page (man 2 chown) says:
When the owner or group of an executable file are changed by a non-
superuser, the S_ISUID and S_ISGID mode bits are cleared. POSIX does
not specify whether this also should happen when root does the chown();
the Linux behavior depends on the kernel version. In case of a non-
group-executable file (i.e., one for which the S_IXGRP bit is not set)
the S_ISGID bit indicates mandatory locking, and is not cleared by a

As there are good arguments for and against clearing the s-Bits during chown, there are probably only good arguments for having an option for chown(1) to preserve the s-Bits. What do you think? (I know this is the wrong list for discussing utils).

Ulrich Windl

 \ /
  Last update: 2013-07-16 11:21    [W:0.029 / U:3.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site