Want to set custom locations for passwd/shadow.

Lance Fredrickson lancethepants at gmail.com
Tue Oct 8 23:54:34 UTC 2013


I'm using Linux-Pam on an embedded linux device, where most the root 
directory is read-only. I compile Linux-Pam and other software with 
--prefix=/opt where addition libraries and applications can be stored 
and run from usb.  It seems that the default location for 'passwd', 
'shadow', and pam.d conf file locations is very much hard-coded to /etc.

I tried running the following command to change all occurrences of /etc 
to /opt/etc, hoping that I then could store passwd/shadow files in 
/opt/etc, and have pam reference those for authentication.

find . -type f -exec sed -i 's,\/etc,\/opt\/etc,g' {} \;

I can now successfully store all the pam.d files in /opt/etc/pam.d, but 
no matter what I try, pam still reference /etc for passwd/shadow.  Any 
occurrence of passwd or shadow when grepping through the code seems to 
all begin with the /opt prefix.
I use pam for ssh and openvpn authentication (also in tandem with google 
two-factor authentication) , and in particular would like to use 
pam_unix to handle this.  It works fine when logging in with users found 
in the default /etc location, but it is much more practical for me to 
maintain my own passwd file in it's own location for the uses mentioned.

thanks for any tips

Lance




More information about the Pam-list mailing list