Действительно ли можно ли направить меня к некоторым примерам и более подробной инструкции относительно/etc/sudoers.d/
Я хотел бы дать некоторое разрешение группы sudo некоторые команды, но надлежащим способом не создать ненужные лазейки в модели обеспечения безопасности Ubuntu на многопользовательской машине.
В древние времена я сделал некоторое простое sudoers удовлетворение требованиям заказчика, но по-видимому теперь/etc/sudoers.d/является более надлежащим путем, и я хотел бы лучше понять это.
Ни на кого не похож, смел так, я провел свое собственное исследование. Вот результаты.
Как этот поток https://superuser.com/questions/869144/why-does-the-system-have-etc-sudoers-d-how-should-i-edit-it подчеркивает, что/etc/sudoers является конфигурационным файлом в масштабе всей системы, который изменяется на обновлениях системы и очень хрупок к неподходящим изменениям. Т.е. можно освободить системный доступ или сделать его не к начальной загрузке больше с неподходящими изменениями.
$ sudo cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
(... some other content ...)
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
Обратное к тому, что можно думать #includedir
, директива не комментарий. Это допустимо и работает для включения всех файлов в /etc/sudoers.d
каталог.
Содержание этого каталога переживает обновления системы, а также sudo является остатками, строгими об этом:
Поэтому менее вероятно, что Вы снижаете систему со своими ошибками.
$ ls -l /etc/sud*
-r--r----- 1 root root 755 sty 20 17:03 /etc/sudoers
/etc/sudoers.d:
total 7
-r--r----- 1 root root 958 mar 30 2016 README
$ sudo cat /etc/sudoers.d/README
#
# As of Debian version 1.7.2p1-1, the default /etc/sudoers file created on
# installation of the package now includes the directive:
#
# #includedir /etc/sudoers.d
#
# This will cause sudo to read and parse any files in the /etc/sudoers.d
# directory that do not end in '~' or contain a '.' character.
#
# Note that there must be at least one file in the sudoers.d directory (this
# one will do), and all files in this directory should be mode 0440.
#
# Note also, that because sudoers contents can vary widely, no attempt is
# made to add this directive to existing sudoers files on upgrade. Feel free
# to add the above directive to the end of your /etc/sudoers file to enable
# this functionality for existing installations if you wish!
#
# Finally, please note that using the visudo command is the recommended way
# to update sudoers content, since it protects against many failure modes.
# See the man page for visudo for more information.
#
Обратите внимание на то, что файлы в этом каталоге должны быть отредактированы с visudo
команда:
$ sudo visudo -f /etc/sudoers.d/veracrypt
GNU nano 2.5.3 File: /etc/sudoers.d/veracrypt.tmp
# Users in the veracryptusers group are allowed to run veracrypt as root.
%veracryptusers ALL=(root) NOPASSWD:/usr/bin/veracrypt
Обратите внимание на то, что visudo
может использовать различных редакторов для фактической задачи, как описано здесь: https://help.ubuntu.com/community/Sudoers
Здесь является еще несколькими ссылками, которые я нашел полезным: