Всякий раз, когда я пытаюсь запустить
su
Password:
, тогда это показывает ошибку
setgid: Operation not permitted
Эта проблема возникает после того, как я изменил разрешения, используя chown
Вывод ls -lsa /bin/su
:
40 -rwxrwxr-x 1 jheel root 40128 May 17 2017 /bin/su
Правильными разрешениями для /bin/su
должны быть: -rwsr-xr-x
-rwsr-xr-x 1 root root 40128 May 17 2017 /bin/su*
Чтобы исправить эту конкретную проблему, вы должны:
This может быть сделано с помощью:
sudo chown root:root /bin/su
sudo chmod 4755 /bin/su
root
. s
для команды /bin/su
. В: Почему при выполнении chown
для /bin/su
также были удалены биты set-user-id
/ set-group-id
?
A: В результате выполнения chown
может быть удалено set-user-id
/ set-group-id
бит. Когда эти биты установлены, выполнение такого файла приведет к запуску файла как владельца двоичного файла, а не как владельца процесса, который выполняет файл. Изменение владельца файла (или группы) без удаления бита set-user-id
приведет к тому, что файл будет выполнен как пользователь, отличный от первоначально запланированного, что может привести к дыре в безопасности.
Некоторые ссылки:
Unless chown is invoked by a process with appropriate privileges, the set-user-ID and set-group-ID bits of a regular file shall be
очищается после успешного завершения; биты set-user-ID и set-group-ID других типов файлов могут быть очищены.
Справочная страница Ubuntu chown
предлагает запустить info coreutils 'chown invocation'
, чтобы получить полную документацию по chown
13.1 ‘chown’: Change file owner and group
=========================================
‘chown’ changes the user and/or group ownership of each given FILE to
NEW-OWNER or to the user and group of an existing reference file.
Synopsis:
....
The ‘chown’ command sometimes clears the set-user-ID or set-group-ID
permission bits. This behavior depends on the policy and functionality
of the underlying ‘chown’ system call, which may make system-dependent
file mode modifications outside the control of the ‘chown’ command. For
example, the ‘chown’ command might not affect those bits when invoked by
a user with appropriate privileges, or when the bits signify some
function other than executable permission (e.g., mandatory locking).
When in doubt, check the underlying system behavior.