[OpenAFS] Help: Make UNIX traditional su command to get OpenAFS token

Lee Eric openlinuxsource@gmail.com
Mon, 13 Jun 2011 17:49:18 +0800


Hi,

As I use ksu to the user it seems pam_afs_session can work well.

[root@submit ~]# kinit huli
Password for huli@HERDINGCAT.INTERNAL:
[root@submit ~]# ksu huli
Changing uid to huli (501)
[huli@submit root]$

But as I use su command it won't work can report that cannot access
the home dir.

[root@submit ~]# kinit huli
Password for huli@HERDINGCAT.INTERNAL:
[root@submit ~]# su -l huli
su: warning: cannot change directory to
/afs/herdingcat.internal/home/huli: Permission denied
-bash: /afs/herdingcat.internal/home/huli/.bash_profile: Permission denied
-bash-4.1$

Here's the /etc/pam.d/system-auth and /etc/pam.d/su configuration files.

system-auth:

auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        sufficient    pam_krb5.so use_first_pass
auth        optional      pam_afs_session.so
auth        required      pam_deny.so

account     required      pam_unix.so broken_shadow
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3 type=
password    sufficient    pam_unix.so sha512 shadow nullok
try_first_pass use_authtok
password    sufficient    pam_krb5.so use_authtok
password    required      pam_deny.so

session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
-session     optional      pam_systemd.so
session     [success=1 default=ignore] pam_succeed_if.so service in
crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_krb5.so
session     required      pam_afs_session.so

su:

auth		sufficient	pam_rootok.so
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

I noticed that su has quote system-auth but it seems not work properly.

Could anyone tell me what's going on?

Thanks very much.

Eric