如何修复损坏的 sudo - sudo: 第 5 行附近 /etc/sudoers.d/ADSM 中的解析错误?

如何修复损坏的 sudo - sudo: 第 5 行附近 /etc/sudoers.d/ADSM 中的解析错误?
$ sudo
sudo: >>> /etc/sudoers.d/ADSM: Alias `TSMADM' already defined near line 5 <<<
sudo: >>> /etc/sudoers.d/ADSM: Alias `TSMCMD' already defined near    line 18 <<<
sudo: >>> /etc/sudoers.d/QUALY: Alias `TRSC' already defined near line 1 <<<
sudo: >>> /etc/sudoers.d/QUALY: Alias `TRSCOPERATION' already defined near line 3 <<<
sudo: >>> /etc/sudoers.d/RCCM: Alias `TCAINST' already defined near line 17 <<<
sudo: >>> /etc/sudoers.d/RCCM: Alias `TCAUNINST' already defined near line 20 <<<
sudo: >>> /etc/sudoers.d/RCCM: Alias `TADDM' already defined near line 23 <<<
sudo: >>> /etc/sudoers.d/RCCM: Alias `TAD4D' already defined near line 24 <<<
sudo: >>> /etc/sudoers.d/RCCM: Alias `RCCM' already defined near line 24 <<<
sudo: >>> /etc/sudoers.d/TOP: Alias `NORSUDO' already defined near line 4 <<<
sudo: >>> /etc/sudoers.d/TOP: Alias `NOVISUDO' already defined near line 4 <<<
sudo: parse error in /etc/sudoers.d/ADSM near line 5
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

请给我一个进入根目录编辑sudoers文件的解决方案。

答案1

sudo: parse error in /etc/sudoers.d/ADSM near line 5
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

这些行表明只有 root(或 UID 0 的其他人)可以修复此问题(通过登录并使用visudo)。

答案2

如果这在虚拟机中导致,则需要重新启动系统。如果这发生在类似云的实例中,那么

卸载附加到实例的卷,然后附加到其他实例卸载卷 cd 到卷编辑 sudoers 文件保存退出驱动器/卷卸载分离附加到第一个实例安装尝试 sudo su -

它会起作用我也尝试过

相关内容