How do I map users with a samba share?

Solution 1:

What you want to do is set up a Samba username map file.

In the [Global] section of your /etc/samba/smb.conf file, you can set the "username map" option to the location of the map file.

[global]
    username map = /pathToMapFile/usermap.txt

The usermap.txt (or whatever you want to call it) contains lines formatted in the style of mapTo = mapFrom. For example, if I wanted to make sure that my user on my Windows box could hit my Samba share on my Ubuntu machine, my usermap.txt file would have a line like this:

myUbuntuUserName = myWindowsUserName

Of course, to see these changes you'll need to restart the Samba service.

sudo service smbd restart

If you need extra help, check out the docs below. The official Samba documentation (below) demonstrates how to map multiple usernames to a single user, or even groups to users.

username map (G)

Username Maps - Administration