В этом вопросе уже есть ответ здесь:
Я случайно владею / etc /
для пользователя Ubuntu в aws ec2
У меня есть / etc /
, и теперь это сообщение появляется всякий раз, когда я использую sudo
:
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Вчера я находил здесь ответы, и у меня нет ' t нашел какое-либо решение, которое не требует остановки экземпляра.
(Это не то же самое, что опубликовано «еще один вопрос», почему? Потому что он все еще может запускать базу sudo на основе комментариев, которые я читал, а это облачный сервер)
Это мой / 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.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
Как мне это исправить?
Необходимо будет загрузить живой CD и работать
sudo chown root:root -R /media/$USER/*/etc
, необходимо будет открыть папку в файловом браузере для монтирования диска
Выполненный: энергия/etc/sudoers
Вы найдете строку подобной:
$ROOT: $ALL
Вставляют эту строку после:
$ <your_uid> : $ALL
, Но Вы должны базироваться полномочия сделать это.
#
# 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.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
**ee209195 ALL=(ALL:ALL) ALL # TODO ADD THIS LINE With your uid**
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d