LoginHook problem (AD/OD)

blabla296

Registered
Hello,

We just received an Xserve and I'm in charge to integrate it on our Windows environment.
I was able to configure bind it, set up the OD so now I've got my "Magic Triangle" working.

I need now have like a NETLOGON folder, containing the all the logon scripts for the AD users login in on the iMacs.
In fact, I need to mount the user's home folder from a smb share on the iMacs users' desktop.
I won't use Home folder mapping in OD as I don't want the folders to exponentialy grow after using Mac applications for like 6 months. Also, as we use DFS, this solution doesn't fit at all.

I searched/tested quite a lot and I ended up having a LoginHook which acts as a wrapper, calling the real login script(s) from an AFP share relaying on the Xserve. Here is the LoginHook :

Code:
#!/bin/sh
	echo Running Centralized Management
	mkdir /Volumes/OD_scripts
	mount_afp afp://"xxx:xxx"@islxsrv1.isl.local/OD_scripts/ /Volumes/OD_scripts

	mkdir /tmp/manage
	chmod 777 /tmp/manage

	cp /Volumes/OD_scripts/*  /tmp/manage/
	chown -v $1 /tmp/manage/*

	su - $1 -c "sh /tmp/manage/h_mount.command"
	exit_value=$?
	if [ ${exit_value} -ne 0 ]; then
	logger -s -t Loginscript -p user.info script failed! 1>&2
	exit $exit_value
	fi

	umount /Volumes/OD_scripts/
	rm -fr /Volumes/OD_scripts
	rm -fr /tmp/manage

exit 0


Here's the 2nd script, called by the LoginHook :

Code:
#!/bin/sh

mount_smbfs //10.100.0.98/vol1/StudentsHome/$USER /Users/$USER/Desktop/
mount_smbfs //10.100.0.98/vol1/Public /Users/$USER/Desktop/


Some explanations on what I've done and why :

- As LoginHooks are run with root privileges before any MCX, I had to create a locked OD user that is used only for connecting the afp share (automount in WGM will be executed AFTER the LoginHook... tested by putting "sleep xx")

- As LoginHooks are run with root privileges, I had to chmod/chown the local directories in which I copy the login script (h_mount.command)

- As LoginHooks are run with root privileges, I had to call the 2nd script using :
Code:
su - $1 -c "sh /tmp/manage/h_mount.command"
because the $1 variable didn't return the current logged in user in the 2nd script. Calling the login script that way, i could use the $USER variable in the 2nd script, wich returns the current owner of the executed shell, in that case the logged in user.

My problem is that it doesn't work as expected. In the logs, I have an error like :
Code:
/tmp/manage/h_mount.command: unknown command:mount_smbfs
So no home folder is mounted :-/

I'm not a Unix pro at all, so I'm quite lost on that one... Any ideas anyone ?
 
Back
Top