Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

When setting up Samba for the first time, it "read" all the users in AD (Ubuntu is on a domain) and added them to the Samba user list. Obviously that isn't what I wanted. With over 1500+ users, I would like to remove all of them and then manually add the ones that need access to the respective folders.

Is there an easier way to remove all Samba users than highlighting them and clicking the "Delete" button (via the Samba GUI)?

share|improve this question
up vote 0 down vote accepted

I would assume you are looking for /etc/samba/smb.conf where all the users and authentication types are.

I think there is a way to switch it back to basic PAM authentication.

You can find more references here:

If you do a sudo nano /etc/samba/smb.conf when you get to the first line of a user just hold down CTRL-K to repeat the DELETE LINE command. Just keep your eye on the bottom of the page so when you see the end of the list come up you can let go and not delete any other commands. But I really do not know if all of them are in there or if your samba config scripts are pulling them, the domain.

share|improve this answer
I found the file /etc/samba/smbusers, but the file was empty. However, when I go into the GUI, all the users are still there. Is there a script I can run that would remove ALL the users in the database? – Oryon007 May 4 '12 at 18:14
/etc/samba/smb.conf will tell you where how samba is acquiring the users. Basically the authentication type has to be discovered. It basically has to be on PAM authentication. Check the section in your smb.conf under AUTHENTICATION. – Frank Barcenas May 4 '12 at 18:19
Thanks for all the help. but it looks like the config is pulling users from the domain. Is there a database file that could just be "purged" that held only the users? – Oryon007 May 4 '12 at 18:20
sorry, you got me there.. since I don't use that type of authentication on my samba it is hard to diagnose it. If there is a file you might discover it doing a sudo ls /etc/samba/ if should display all the files in the directory, and you can NANO them one by one until you run into something interesting. – Frank Barcenas May 4 '12 at 18:26

To delete a user from samba, just type

pdbedit -x -u username
share|improve this answer

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.