I want to map a large number of login usernames to a few unix users, so I guessed the username map config option is an appropriate way.

I enabled it for a particular share in smb.conf:

security = share
username_map = /etc/samba/some_share.map

and added all the usernames to the map:

some_share_user = anton berta caesar ...

But how do I set the passwords for those users?

# smbpasswd -a anton
New SMB password:
Retype new SMB password:
Failed to add entry for user anton.

Though it doesn't say so explicitly, I guess this is because smbpasswd checks if there is a matching unix user and forgets to check all the username maps, too.


The document you linked to explicitly states

Please note that for user or share mode security, the username map is applied prior to validating the user credentials.

This means that you will have to set a shared password for some_share_user and make anton, berta, and caesar log in with that password.

It works exactly the opposite way if anton, berta, and caesar are users in a Windows domain. They will use their domain credentials to log in to your samba server. Then samba will map them to some_share_user.

  • 1
    In other words, it is not possible to have one common UNIX user but different passwords for different users. – AndreKR Mar 28 '12 at 17:01
  • But with security = share deprecated, how do we achieve this objective? – John Strood Jan 1 '19 at 14:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.