Introduction link
You may be in a situation like mine where you have your Solaris connected to an LDAP server or similar, and you’re facing the problem of automatic home directory creation for users who connect. After 2-3 hours of struggles, I finally managed to compile and configure everything.
Here’s my documentation to save time for others who might face the same issue.
Prerequisites link
First, you’ll need a small package to avoid errors like this:
1
| ld: fatal: file values-Xa.o: open failed: No such file or directory
|
To avoid this problem, install the SUNWarc package:
1
| pkgadd -d . /cdrom/cdrom0/Solaris_10/Product/SUNWarc
|
You’ll also need to install gcc:
1
| pkg-get install gcc4core gcc4g++
|
Then, we’ll add these to our path:
1
2
| export PATH=$PATH:/opt/csw/gcc4/bin
export CC=gcc
|
Compilation link
Now we can proceed with the compilation.
1
2
3
4
5
6
7
8
9
10
| wget http://www.kernel.org/pub/linux/libs/pam/pre/library/Linux-PAM-0.81.tar.bz2
./configure
cp _pam_aconf.h libpam/include/security
cd modules/pammodutil
gcc -c -O2 -D_REENTRANT -DPAM_DYNAMIC -Wall -fPIC -I../../libpam/include -I../../libpamc/include -Iinclude modutil_cleanup.c
gcc -c -O2 -D_REENTRANT -DPAM_DYNAMIC -Wall -fPIC -I../../libpam/include -I../../libpamc/include -Iinclude modutil_ioloop.c
gcc -c -O2 -D_REENTRANT -DPAM_DYNAMIC -Wall -fPIC -I../../libpam/include -I../../libpamc/include -Iinclude modutil_getpwnam.c -D_POSIX_PTHREAD_SEMANTICS
cd ../pam_mkhomedir
gcc -c -O2 -D_REENTRANT -DPAM_DYNAMIC -Wall -fPIC -I../../libpam/include -I../../libpamc/include -I../pammodutil/include pam_mkhomedir.c
/usr/ccs/bin/ld -o pam_mkhomedir.so -B dynamic -G -lc pam_mkhomedir.o ../pammodutil/modutil_*.o
|
Installation link
Installation is quite simple. Still in the source directory, execute:
1
2
3
4
| cp pam_mkhomedir.so /usr/lib/security/pam_mkhomedir.so.1
cd /usr/lib/security
ln -s pam_mkhomedir.so.1 pam_mkhomedir.so
chown root:bin pam_mkhomedir.so.1
|
That’s it! :-)
Configuration link
For configuration, we’ll simply edit pam.conf and add this line:
1
2
3
4
5
6
7
| ...
# Default definition for Session management
# Used when service name is not explicitly mentioned for session management
#
other session required pam_unix_session.so.1
other session required pam_mkhomedir.so.1 skel=/etc/skel/ umask=0022
...
|
You can now log in and you’ll get this message on the first login of a user:
Creating directory '/home/pmavro'.
Resources link
Last updated
06 Oct 2009, 08:44 CEST. history