# PAM setup (may not be needed depending on the kernel used)
echo "Creating a default PAM file at /lib/security/pam_permit.so"
if [ -e /lib/security/pam_permit.so ]; then
cp -a /lib/security/pam_permit.so /
echo "OTHER auth optional /lib/security/pam_permit.so" > tempfs/etc/pam.conf
echo "OTHER account optional /lib/security/pam_permit.so" >> tempfs/etc/pam.conf
echo "OTHER password optional /lib/security/pam_permit.so" >> tempfs/etc/pam.conf
echo "OTHER session optional /lib/security/pam_permit.so" >> tempfs/etc/pam.conf
fi

# NSS setup (may not be needed depending on the kernel used)
echo "Creating a default NSS file at /etc/nsswitch.conf"
echo "passwd: files" > tempfs/etc/nsswitch.conf
echo "shadow: files" >> tempfs/etc/nsswitch.conf
echo "group: files" >> tempfs/etc/nsswitch.conf
echo "hosts: files" >> tempfs/etc/nsswitch.conf
echo "services: files" >> tempfs/etc/nsswitch.conf
echo "networks: files" >> tempfs/etc/nsswitch.conf
echo "protocols: files" >> tempfs/etc/nsswitch.conf
echo "rpc: files" >> tempfs/etc/nsswitch.conf
echo "ethers: files" >> tempfs/etc/nsswitch.conf
echo "netmasks: files" >> tempfs/etc/nsswitch.conf
echo "bootparams: files" >> tempfs/etc/nsswitch.conf
echo "automount: files" >> tempfs/etc/nsswitch.conf
echo "aliases: files" >> tempfs/etc/nsswitch.conf
echo "netgroup: files" >> tempfs/etc/nsswitch.conf
echo "publickey: files" >> tempfs/etc/nsswitch.conf