emh_alpha1
Registered
We're needing to use a script to create local home directories on a workstation based on an LDAP lookup against our Netware NDS database.
The script runs fine from root's terminal. If i connect it up to LoginHook in /etc/ttys I can login and it copies the model directory, names it properly and logins in, but does not changes the permissions on the directory at all. I've checked the script is running as root, but for some reason I cannot correct the permissions.
Any ideas - this is quite urgent.
Thanks in advance.
M.
script -->
#!/bin/sh
USERNAME=$*
GID=`id -g`
echo "running as: $GID" > /test
echo "Checking user: $USERNAME"
if test -d "/users/$USERNAME"
then
echo "Directory: $USERNAME already exists"
else
echo "Directory: $USERNAME does not exist"
echo "Creating directory: $USERNAME"
# uppercase username
USERNAME=`echo $USERNAME | tr a-z A-Z`
USERID=`id $USERNAME | cut -f 2 -d "=" | cut -f 1 -d "("`
echo $USERID
ditto -rsrc /system/library/user\ template/english.lproj /users/$USERNAME
echo "Setting default priveleges"
sudo chown -R $USERID:1000 /users/$USERNAME
sudo chmod -R 700 /users/$USERNAME
sudo chmod 755 /users/$USERNAME/Public
sudo chmod 755 /users/$USERNAME/Sites
sudo chmod 733 /users/$USERNAME/Public/Drop\ Box
echo "Created directory: $USERNAME"
fi
The script runs fine from root's terminal. If i connect it up to LoginHook in /etc/ttys I can login and it copies the model directory, names it properly and logins in, but does not changes the permissions on the directory at all. I've checked the script is running as root, but for some reason I cannot correct the permissions.
Any ideas - this is quite urgent.
Thanks in advance.
M.
script -->
#!/bin/sh
USERNAME=$*
GID=`id -g`
echo "running as: $GID" > /test
echo "Checking user: $USERNAME"
if test -d "/users/$USERNAME"
then
echo "Directory: $USERNAME already exists"
else
echo "Directory: $USERNAME does not exist"
echo "Creating directory: $USERNAME"
# uppercase username
USERNAME=`echo $USERNAME | tr a-z A-Z`
USERID=`id $USERNAME | cut -f 2 -d "=" | cut -f 1 -d "("`
echo $USERID
ditto -rsrc /system/library/user\ template/english.lproj /users/$USERNAME
echo "Setting default priveleges"
sudo chown -R $USERID:1000 /users/$USERNAME
sudo chmod -R 700 /users/$USERNAME
sudo chmod 755 /users/$USERNAME/Public
sudo chmod 755 /users/$USERNAME/Sites
sudo chmod 733 /users/$USERNAME/Public/Drop\ Box
echo "Created directory: $USERNAME"
fi