Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I installed Samba 4 and I need to execute a bash script after a user is created from a Windows machine.

With Samba 3 I used the add user script = /usr/sbin/adduser %u -s /bin/false -m -g users

So, I add to smb.conf : add user script = /path/to/myScript.sh, when I do a testparm it print the line, but the script is not execute neither when I create a user with the AD mmc from Windows neither when I do a smbpasswd -a user

I checked script permissions (755), to be sure I just made the script print some text in a /tmp/file.txt. I also tried the old /usr/sbin/adduser %u -s /bin/false -m -g users, but doesn't create user neither...

Can anyone tell me how can I execute a script right after a user is created with the AD mmc please ?

Edit :

I tested that :

-(with add user script = /path/to/MyScript.sh in smb.conf) Create a user > authenticate with it > check (nothing happened) > log off > check (still nothing) > removed user for new test.

-(with /bin/bash /path/to/MyScript.sh) Restart Samba > Create a user > authenticate with it > check (nothing happened) > log off > check (still nothing) > removed user for new test.

-(with /bin/bash /usr/sbin/adduser %u -s /bin/false -m -g users) Restart Samba > Create a user > authenticate with it > check (nothing happened) > log off > check (still nothing).

share|improve this question
    
add user script is called when a Windows user tries to authenticate against the Samba Server, and if this user is not yet registered in the Linux password database. So, maybe it is a silly question, but have you tried to authenticate against the Samba Server with a newly created user in AD ? (ps: i would use the old /usr/sbin/adduser %u -s /bin/false -m -g users. The issue with the new one could be the path to sh : add user script = /path/to/sh /path/to/myScript.sh) –  krisFR Jan 13 at 15:51
    
I tried : -(with <code>/path/to/MyScript.sh</code>) Create a user > authenticate with it > check (nothing happened) > log off > check (still nothing) > removed user for new test. -(with <code>/bin/bash /path/to/MyScript.sh</code>) Restart Samba > Create a user > authenticate with it > check (nothing happened) > log off > check (still nothing) > removed user for new test. -(with <code>/bin/bash /usr/sbin/adduser %u -s /bin/false -m -g users</code>) Restart Samba > Create a user > authenticate with it > check (nothing happened) > log off > check (still nothing). –  ouzmoutous Jan 14 at 7:07
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.