禁止root,处理错误 sudo must be owned by uid 0

一、使用非 root 登陆是,sudo出现错误

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set
处理:从新 root 登陆后
chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo

二、禁止 root 远程登陆

*** 不是禁止 root 登陆,不能禁止 root 帐号
#sudo vim /etc/ssh/sshd_config
找到 PermitRootLogin yes 改成 no
*** 若是反过来,恢复 root 远程,找到
找到并注释掉这行:PermitRootLogin prohibit-password
PermitRootLogin no 改成 yes

** 修改以后,sudo /etc/init.d/sshd restart ,或者直接 reboot 重启

三、其余帐号加入 sudo

首先切换到 root
执行 su ,输入密码
vi /etc/sudoers,在如下地方加上 XXX (用户名)
# User privilege specification
	 root   ALL=(ALL:ALL) ALL
	dhbm    ALL=(ALL:ALL) ALL
相关文章
相关标签/搜索