Curiosamente. isso parece impossível usando o GNU chmod
, e isso é um recurso. A partir da entrada info
em chmod
no meu sistema; observe como, embora a entrada na definição dos bits faça referência aos modos simbólico e numérico, a entrada na limpeza refere-se apenas ao modo simbólico ( ug-s
):
27.4 Directories and the Set-User-ID and Set-Group-ID Bits
These convenience mechanisms rely on the set-user-ID and set-group-ID bits of directories. If commands like
chmod' and
mkdir' routinely cleared these bits on directories, the mechanisms would be less convenient and it would be harder to share files. Therefore, a command like 'chmod' does not affect the set-user-ID or set-group-ID bits of a directory unless the user specifically mentions them in a symbolic mode, or sets them in a numeric mode.[...]
If you want to try to set these bits, you must mention them explicitly in the symbolic or numeric modes, e.g.:
[...]
If you want to try to clear these bits, you must mention them explicitly in a symbolic mode, e.g.:
[...]
This behavior is a GNU extension. Portable scripts should not rely on requests to set or clear these bits on directories, as POSIX allows implementations to ignore these requests.