当前位置: 首页> 汽车> 行情 > java免费_东方财富网官方网站首页_网络营销成功案例ppt_百度手机版网页

java免费_东方财富网官方网站首页_网络营销成功案例ppt_百度手机版网页

时间:2025/8/6 15:15:37来源:https://blog.csdn.net/qi_yue_yu/article/details/143507333 浏览次数: 0次
java免费_东方财富网官方网站首页_网络营销成功案例ppt_百度手机版网页

Ubuntu 命令行操作过程中,不小心将 /etc 整个文件夹的所属者都给了当前用户(非root),导致了使用sudo 会出现以下问题,想将/etc所属改回来也不行了,进退两难

sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit

test@test-ubuntu:~$ sudo chown -R test /etc
[sudo] password for test: 
test@test-ubuntu:~$ sudo cd /etc
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
test@test-ubuntu:~$ ll /etc
total 1240
drwxr-xr-x 140 test root 12288 11月  5 13:57 ./
drwxr-xr-x  21 root root  4096  4月  8  2022 ../
drwxr-xr-x   3 test root  4096  4月 19  2022 acpi/
-rw-r--r--   1 test root  3028  4月 19  2022 adduser.conf
drwxr-xr-x   3 test root  4096  4月 19  2022 alsa/
drwxr-xr-x   2 test root  4096 11月  5 11:02 alternatives/

也即sudo  不能使用了,修改/etc/sudo.conf也修改不了

test@test-ubuntu:~$ ll /etc/sudo.conf
-rw-r--r-- 1 test root 4573  2月 14  2022 /etc/sudo.conf
test@test-ubuntu:~$ sudo chown root /etc/sudo.conf
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudo.conf is owned by uid 1000, should be 0
sudo: /etc/sudoers is owned by uid 1000, should be 0
sudo: no valid sudoers sources found, quitting
sudo: error initializing audit plugin sudoers_audit
test@test-ubuntu:~$ chown root /etc/sudo.conf
chown: changing ownership of '/etc/sudo.conf': Operation not permitted
test@test-ubuntu:~$ 

解决方法

根据网上提的方法,

Ask Ubuntu

1、执行下面命令

pkexec chown root:root /etc/sudoers /etc/sudoers.d -R

sudo 能够输入密码了。后三句话错误没有了。

2、再执行 命令将/etc 所属修改回root

sudo chown -R root /etc

sudo:*** 只出现一次,再修改就没有出现了。/etc 又恢复以前的用户(组)了

/etc文件夹的属性不要轻易改动。

参考链接 Ask Ubuntu

关键字:java免费_东方财富网官方网站首页_网络营销成功案例ppt_百度手机版网页

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: