SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/05/01 14:08 2 Comments
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

aixautohomedir

AIX Home Directory

Under normal circumstances you would use the PAM module pam_mkhomedir.so to create a home directory when it not exists and a user logins. This does not work using SSH because this is considered a security breach. This article is about the autocreation of a home directory when users login using SSH. Because the pam module doesn't work anymore we use the “make_home_dir” program from TrustSec.

Note: The recommendations used here are mostly from the readme, this readme was however created for linux so a few commands didn't work. The commands used here are for AIX.

Installation make_home_dir

The installation of make_home_dir on AIX is not so straight forward as hoped for. I had to perform these steps to get it working:

  1. System setup
  2. Modification make file
  3. Compile source
  4. Configure /etc/profile

System setup

Before the program can be installed you need to setup your system: Do the following, to setup your system: Add a group named 'home':

$ mkgroup home

Now make the parent of the home-directories writeable to this group:

$ chgrp home /home
$ chmod g+w /home

AIX 6.1

Additionally, on AIX 6.1 you have to manually create the directory /usr/local/sbin:

mkdir /usr/local
mkdir /usr/local/sbin

Modification make file

The makefile is created for linux and doesn't work out of the box on AIX. This is the original makefile:

# (c) Copyright 2003 -- Frank Kirschner <kirschner@trustsec.de>
#
# The install-dir of the binary
BIN_DIR=/usr/local/sbin
# The group, that make_home_dir should be started with
GROUP=home
# The parent-directory of all home-directories
HOME_PARENT=/home




SRC=make_home_dir.c
FILE=make_home_dir
DEST=$(BIN_DIR)/$(FILE)

all:	$(FILE)

install: $(FILE)
	cp $(FILE) $(DEST)
	strip $(DEST)
	chgrp $(GROUP) $(DEST)
	chmod g+s $(DEST)

setup:
	groupadd $(GROUP)
	chgrp $(GROUP) $(HOME_PARENT)
	chmod g+w $(HOME_PARENT)

clean:
	rm -f $(FILE)


$(FILE):	$(SRC)
	gcc -Wall -o $@ $<

To make this file work on AIX you'll have to edit the last line:

gcc -Wall -o $@ $<

to:

gcc -Wall -o $@ $(SRC)

error

If you don't change the makefile you'll get this error:

root@ms-lpar04:/tmp/sft/make_home_dir-1.0>make
        gcc -Wall -o make_home_dir
gcc: no input files
make: The error code from the last command is 1.

Compile source

After this you can finally compile the source:

root@ms-lpar04:/tmp/sft/make_home_dir-1.0>make
Target "all" is up to date.
root@ms-lpar04:/tmp/sft/make_home_dir-1.0>make install
        cp make_home_dir /usr/local/sbin/make_home_dir
        strip /usr/local/sbin/make_home_dir
        chgrp home /usr/local/sbin/make_home_dir
        chmod g+s /usr/local/sbin/make_home_dir
root@ms-lpar04:/tmp/sft/make_home_dir-1.0>ls
COPYRIGHT        Makefile         README           make_home_dir    make_home_dir.c

Configure profile

Now you have to add some code to the /etc/profile script. The original code is again for linux and doesn't work completely on AIX. This is the original code:

if [ ! -d $HOME ]
then
   logger Creating new home-directory $HOME
   /usr/local/sbin/make_home_dir
   cd $HOME
   cp -a /etc/skel/. $HOME/.
   echo Home directory created
fi

To make it work on AIX change this line:

cp -a /etc/skel/. $HOME/.

to

cp /etc/skel/.[^\.]* $HOME/

NOTE: for this to work you'll have to change the default shell to /bin/bash. This is already been set for LUM enabled users in eDirectory.

You could leave a comment if you were logged in.
aixautohomedir.txt · Last modified: 2013/01/26 20:09 by sjoerd