禁止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
相關文章
相關標籤/搜索