添加新用户汤姆
useradd -m -p 12345 -s /bin/bash -G wheel tom
将用户从 root 切换到 tom
su tom
即使我输入正确的密码,汤姆也无法使用 sudo。
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
/etc/sudoers
%wheel (ALL)=(ALL) ALL
/etc/pam.s/su uncommented
auth required pam_wheel.so
$ groups
tom wheel
答案1
从man useradd (8)
:
-p, --password PASSWORD
加密密码,由 crypt(3) 返回。默认是禁用密码。
调查一下/etc/shadow
你会发现加密的密码是12345
.所以你的密码错误也就不足为奇了。
您可以使用 root 身份更改密码
passwd tom
它应该有效。