Configuring samba to change ownership virtually

Posted on

Configuring samba to change ownership virtually – Managing your servers can streamline the performance of your team by allowing them to complete complex tasks faster. Plus, it can enable them to detect problems early on before they get out of hand and compromise your business. As a result, the risk of experiencing operational setbacks is drastically lower.

But the only way to make the most of your server management is to perform it correctly. And to help you do so, this article will share nine tips on improving your server management and fix some problem about linux, samba, file-permissions, file-server, .

We have 2 ubuntu 8.04 LTS fileservers running samba version 3.0.28a-1ubuntu4.12, they export samba shares for windows server 2003 machines. There is no windows AD domain, just plain user authentication. From /etc/samba/smb.conf:

[global]
        workgroup = WORKGROUP
        security = SHARE
        passdb backend = smbpasswd:/etc/samba/smbpasswd
        unix password sync = no
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        panic action = /usr/share/samba/panic-action %d
        encrypt passwords = true
        invalid users = root
        hosts allow = 10.1.1.0/24

[md0]
        comment = md0
        path = /mnt/md0/smb/share1
        valid users = user1
        force user = root
        force group = root
        read only = no
        create mask = 0660
        directory mask = 0770
        browseable = Yes

/mnt/md0/ is a raid system and file permissions are root.root for historical reasons.

On a windows server 2003 machine we access the share with a script:

net use t: \fileserver0md0 passwordforuser1 /user:user1

On the windows machine we now see Unix userroot as the owner:

alt text

This is logically correct.

But is there a chance to change samba configuration so we see user1.user1 as owner on the windows side instead of Unix userroot?

Solution :

First, You could adjust the groupmappings in samba, to adjust the group that will be shown :

net groupmap add unixgroup=root ntgroup=user1

Second, You can map individual users by modifying samba.conf by adding

username map = /etc/samba/smbusers

to the [global] section, and then making the file /etc/samba/smbusers containing :

root: user1

Leave a Reply

Your email address will not be published. Required fields are marked *