Linux_su 处理方法
[[email protected] ~]# su - user1
su: incorrect password
[[email protected] ~]# su - user1
su: incorrect password
[[email protected]~]# su - user1
su: incorrect password
注:如果出现此类的故障,解决的思路如下
1. 查看/bin/su的配置文件的权限
[[email protected] ~]# ll /bin/su
-rwsr-xr-x. 1 root root 34904 Mar 10 2011 /bin/su
注:-rwsr-xr-x. 这样的权限是正确,如果不是这样的权限,则代表有问题,多半都可以解决问题
2. 查看配置文件/etc/passwd and /etc/shadow 的文件有没有空行
cat /etc/passwd | grep "^$"
cat /etc/shadow | grep "^$"
如果有空行的话,则可以把他们给删除
sed -i ‘/^$/d‘ /etc/passwd
sed -i ‘/^$/d‘ /etc/shadow
3. 如果还是不能su登录的话,则查看配置文件
[[email protected] ~]# cat /etc/pam.d/su
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
# Uncomment the following line to require a user to be in the "wheel" group.
#auth required pam_wheel.so use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet ###主要是查看这行的配置,如果没有,则代表有错误
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so
设置这样,再进行su
[[email protected] ~]# su - user1
[[email protected]~]$
这样就可以进行su的操作