[Samba] Pam mkhomedir - Permissions

Tony Earnshaw tonye at billy.demon.nl
Wed Apr 20 11:48:53 GMT 2005


Cristian Thiago Moecke wrote:

>   How can I do that?

(answer sent to the list, since that's where the question was asked).

Well, how you do it is up to you. How I do it on different rigs, is (and 
I hasten to say that I stole this from a poster this list):

/etc/samba/smb.conf:

[homes]
root preexec = /etc/samba/scripts/mk_sambadir "/m/samba3/home/%u" "%u" "%g"

[Profiles]
root preexec = /etc/samba/scripts/mk_sambadir "/m/samba3/profiles/%U" 
"%U" "%g"

/etc/samba/scripts/mk_sambadir:
#!/bin/bash
if [ ! -d "$1" ]
then
   mkdir "$1"
fi
   chmod 770 "$1" -R
   chown "$2" "$1" -R
   chgrp "$3" "$1" -R

You'll maybe have to swap some of the variables around to suit your needs.

--Tonni

>>tir, 19.04.2005 kl. 19.13 skrev Cristian Thiago Moecke:
>>
>>  
>>
>>>I would like to set special permissions (ACL) when pam autocreates my 
>>>home dirs in samba. I think i should use a script for that. My question 
>>>is: how can I make pam run a bash script after it creates the homedir?
>>>    
>>>
>>Perhaps you should be looking at another method of making homedirs on
>>the fly. I use a small root prexec script to make users' home and
>>profile directories if they don't exist the first time a user logs on.
>>
>>--Tonni
>>
>>  
>>
> 
> !DSPAM:42663beb224211530211831!


-- 

mail: tonye at billy.demon.nl
http://www.billy.demon.nl

They love us, don't they, They feed us, won't they ...


More information about the samba mailing list