Strange behaviour of 'вспотел chmod-rwx': Does not remove group write permissions

I just ran the following command in в directory with several поля, some owned by root, some by в нормальный user. I got в strange message:

$ sudo chmod -rwx *
chmod: example-file: new permissions are ----w----, not ---------

Why the heck does chmod refuse to clear all permissions, if в file had group write rights? What is the thought behind this behaviour?

And is there в way to я вынудил removing all permissions in one step, without having to execute sudo chmod g-w * afterwards?

6
задан 8 January 2016 в 14:57

1 ответ

От man chmod (шахта акцента):

A  combination  of the letters ugoa controls which users' access to the
file will be changed: the user who owns it  (u),  other  users  in  the
file's group (g), other users not in the file's group (o), or all users
(a).  If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.

Это поведение работает, как предназначено, таким образом, не ошибка. См. комментарии № 4 и № 5 в этот отчет об ошибках .

$ touch 1; ll
total 0
-rw-rw-r-- 1 muru muru 0 Jan  9 03:17 1
$ chmod -rwx *; ll
total 0
---------- 1 muru muru 0 Jan  9 03:17 1
$ umask
002
$ umask 072; chmod ug+rw *
$ chmod -rwx * 
chmod: 1: new permissions are ---rw----, not ---------
$ chmod a-rwx *; ll
total 0
---------- 1 muru muru 0 Jan  9 03:17 1

не ленивый осел. Используйте a.

8
ответ дан 23 November 2019 в 07:38

Другие вопросы по тегам:

Похожие вопросы: