Click to See Complete Forum and Search --> : Samba configuration - force user


archmonkey
06-27-2004, 04:59 AM
I have set up a samba server on my gentoo box and have a small problem.

One of the shares is my htdocs directory where I store my web documents for the apache2 server. I want all files copied to or created here to get the owner wwwadmin and belong to the group wwwadmin.

My smb.conf looks like this:

[global]
workgroup = HOME
netbios name = LINUX
server string = Samba Server %v
interfaces = 192.168.0.1/255.255.255.0
security = SHARE
map to guest = Bad User
log file = /var/log/samba3/log.%m
max log size = 50
socket options = TCP_NODELAY SO_SNDBUF=32768 SO_RCVBUF=32768
printcap name = cups
dns proxy = No
ldap ssl = no
printer admin = @adm
hosts allow = localhost, 192.168.0.
printing = cups

[wwwroot]
path = /inetroot/www
username = +wwwadmin
valid users = martin, wwwadmin
write list = martin, wwwadmin
force user = wwwadmin
force group = wwwadmin
create mask = 0664
directory mask = 0775
hide dot files = No

I can also say that all files and directories in my htdocs share are owned by the user wwwadmin and belong to the group wwwadmin.

When copying a file to the share it do get the correct permissions (i.e. 0664) and the same goes for directories. It also belong to the group wwwadmin, but the owner of the file (and also created directories) becomes root and not wwwadmin which I intend it to be.

I hope someone can help me understand why

Thanks in advance

Martin N

mdwatts
06-27-2004, 01:04 PM
I've moved this to the Networking forum in hopes one of our Samba gurus will be able to assist you.

happybunny
06-27-2004, 02:16 PM
i beleive you have to set the setgid on the directory itself...I'm not sure this is a samba config issue.

on the folder itself, try:

chmod g+s htdocs

I think this will make every thing created in this directory owned by the current owner:group.

but check it out before committing major changes

archmonkey
06-27-2004, 03:12 PM
Right on!!

You were absolutely right. That solved my problem

Thanks a lot

\Martin N