如果需要对某用户su命令也不需要输入密码,则需要修改下列的:
1)切换到root权限;
2)创建group为wheel,命令为groupadd wheel;
3)将用户加入wheel group中,命令为usermod -G wheel joe;
4)修改su的配置文件/etc/pam.d/su,增加下列项:
auth required pam_wheel.so group=wheel
# Uncomment this if you want wheel members to be able to
# su without a password.
auth sufficient pam_wheel.so trust use_uid
至此你可以使用例如如下的命令且不需要输入密码:su joe -c command。