[CentOS] nis and new users

Tue Apr 15 16:16:25 UTC 2008
Ross S. W. Walker <rwalker at medallion.com>

Jason Pyeron wrote:
> 
> Ross S. W. Walker wrote:
> > 
> > Jason Pyeron wrote:
> > >
> > > Every time a "new" user logs into a development box (which does not use nfs
> > > for the home dirs) the get could not chdir to their home dir. They call me
> > > with the error and I do a:
> > >
> > > cp -a /etc/skel/ ~USER && chown USER.users -R ~USER/
> > >
> > > and it is fixed.
> > >
> > > Is there an automated way?
> > 
> > Look at pam_mkhomedir and see if it fits your bill.
> > 
> 
> 
> Yes that is exactly what we need.
> 
> /etc/pam.d/login
> 
> #%PAM-1.0
> auth       required     pam_securetty.so
> auth       required     pam_stack.so service=system-auth
> auth       required     pam_nologin.so
> account    required     pam_stack.so service=system-auth
> password   required     pam_stack.so service=system-auth
> # pam_selinux.so close should be the first session rule
> session    required     pam_selinux.so close
> session    required     pam_mkhomedir.so
> session    required     pam_stack.so service=system-auth
> session    required     pam_loginuid.so
> session    optional     pam_console.so
> # pam_selinux.so open should be the last session rule
> session    required     pam_selinux.so open
> 
> 
> but still get:
> 
> Last login: Tue Apr 15 11:24:57 2008 from xxxxxxxx.myvzw.com
> Could not chdir to home directory /home/USER: No such file or 
> directory
> -bash-3.00$
> 
> Any ideas?

Well what you have will only cover console logins via the login
process, not GUI xdm/gdm/kdm or ssh/telnet/ftp/rsh logins.

Try this:

/etc/pam.d/system-auth
#%PAM-1.0
# This file is auto-generated.
# User changes will be destroyed the next time authconfig is run.
auth        required      pam_env.so
auth        optional      pam_group.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        required      pam_deny.so

account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
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
password    sufficient    pam_unix.so md5 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_mkhomedir.so skel=/etc/skel umask=0077 silent
session     required      pam_limits.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

Of course tailor for your environment.

I have tested this config to persist through different authconfig's.

-Ross

______________________________________________________________________
This e-mail, and any attachments thereto, is intended only for use by
the addressee(s) named herein and may contain legally privileged
and/or confidential information. If you are not the intended recipient
of this e-mail, you are hereby notified that any dissemination,
distribution or copying of this e-mail, and any attachments thereto,
is strictly prohibited. If you have received this e-mail in error,
please immediately notify the sender and permanently delete the
original and any copy or printout thereof.