Redhat 7 su切换用户时,不显示last login信息

问题描述:

切换用户时,会出现红色部分的提示信息。有时候会影响之前脚本的正常运行,如何去掉它。

[root@rac1 ~]# su - oracle
Last login: Tue Mar 21 17:44:11 CST 2017

解决方法:

修改 /etc/pam.d/su文件

[root@rac1 ~]# 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 substack syste-auth
auth include postlogin
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
account include system-auth
password include system-auth
session include system-auth
#session include postlogin   ----注释掉即可
session optional pam_xauth.so

验证:

[root@rac1 ~]# su - oracle
[oracle@rac1 ~]$ 
上一篇:python脚本不从cron运行


下一篇:在linux环境版本为centos7中改root的密码复杂度