Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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/

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.

share|improve this question
up vote 0 down vote accepted

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.

share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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