[Samba] Automagic creation of user a/c & homedir when I creat
e a NT domai n user (???)
Freeman, Peter (ERHS)
Freeman.Peter at saugov.sa.gov.au
Sun Mar 9 23:06:49 GMT 2003
>Has anybody got a script that auto-creates a linux user (...&
>hence a Samba
>home dir) when a user a/c is created on the M$ DC? eg, the way
Have a look at the "useradd script" parameter, we use it here for
a Samba box which is a member of the NT domain. All our data is
stored on the Samba box and drives are mapped to it in the logon
script. All we do is create a user on the NT PDC and when the user
logs on for the first time the user is created on the Samba box via
the useradd script which creates a user, their home directory etc
etc. It works extremely well and you're only limited by your imagination
as to what you can do with the script.
smb.conf (global):
add user script = /home/samba/smbscripts/newuser.sh %u
newuser.sh:
#!/bin/sh
# create user
/usr/sbin/useradd -n -d /dev/null -s /bin/false -g 100 $1
# create user directory & change permissions
mkdir -m 1770 /home/samba/users/$1
chown $1.g-users /home/samba/users/$1
# create files subfolder & change permissions
mkdir -m 1770 /home/samba/users/$1/files
mkdir -m 1770 /home/samba/users/$1/files/Documents
mkdir -m 1770 /home/samba/users/$1/files/Email
mkdir -m 1770 /home/samba/users/$1/files/Templates
chown -R $1.g-users /home/samba/users/$1/files
More information about the samba
mailing list