日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

修改/etc/sudoers权限后的补救方法

發布時間:2025/7/14 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 修改/etc/sudoers权限后的补救方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

/etc/sudoers的權限必須是0440,錯誤修改成0777后導致sudo命令無法使用。

xxx@yyy:~$ sudo more /etc/sudoers.d/README
[sudo] password for xxx:
#
# 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!
#

解決辦法1:如果系統中有root用戶,那么只需要登錄root用戶修改/etc/sudoers文件的權限。

su root

chmod 0440 /etc/sudoers

但如果此時未設置root用戶或密碼,無法登錄root用戶。

解決辦法2:可在普通用戶下通過pkexec命令來修改權限。

在重新返回通常模式下,執行pkexec chmod 0440 /etc/sudoers

xxx@yyy:~$ pkexec chmod 0440 /etc/sudoers
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ===
Authentication is needed to run `/bin/chmod' as the super user
Authenticating as: xxx,,, (xxx)
Password:
==== AUTHENTICATION COMPLETE ===

解決辦法3:

1、重啟機器,按下SHIFT,選擇recovery mode,蹦出來一個菜單,選擇root進入root shell。

?mount -o remount,rw /

chmod 0440 /etc/sudoers

2、重啟進入普通狀態下的系統,就能sudo了

?

轉載于:https://www.cnblogs.com/walker-lin/p/11384354.html

總結

以上是生活随笔為你收集整理的修改/etc/sudoers权限后的补救方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。