TAG | linux
27
Can’t add users to Samba: NT_STATUS_UNSUCCESSFUL
2 Comments · Posted by Dr Ron in Internet, Technical
Another self-indulgent blog post, so next time I have this problem, I don’t waste hours trying to fix something I’ve successfully tackled in the past. Hopefully this helps someone else.
The mysterious, magical Samba service is great when it works. When it doesn’t, it can be extraordinarily frustrating.
Problem
You can’t add Samba users at your Linux console. You get this error; for example, by issuing an “smbpasswd -a” command:
Unable to modify TDB passwd: NT_STATUS_UNSUCCESSFUL! Failed to add entry for user xyz. Failed to modify password entry for user xyz
The username is a valid Linux user, and the account is unlocked.
I also tried deleting the Samba user with an “smbpasswd -x”, but to no avail. Stopping and starting the SMB and NMB services does not resolve the problem.
My system details
OS / Kernel: Fedora 9 – 2.6.27.25-78.2.56.fc9.i686
Samba package: samba-3.2.11-0.28.fc9.i386
Solution
** WARNING **!! This solution worked for me, but obviously, no warranties are made for any other systems. Make backups and proceed at own risk.
A post on a Debian forum suggested that the Samba password file might be corrupt. The password file is a binary called “passdb.tdb” and will be re-created, if it doesn’t exist, when SMB and NMB are restarted.
Note that you’ll need to re-add all your Samba users and passwords!
- Locate passdb.tdb
- Make a backup of passdb.tdb
- Remove passdb.tdb
- Stop the SMB and NMB daemons
- Start the SMB and NMB daemons
At this point you should see that a new, much smaller passdb.tdb has been created.
Try adding your user again with an “smbpasswd -a” command. Add your other Samba users with the same command.
It worked for me. Good luck.
This is predominantly a techy, self-indulgent post, which exists for two reasons:
- there are a lot of people on the intranets that appear to have this, or a similar, problem; and
- when I come across this problem again, and I’ve forgotten what I did to fix it, at least I’ve got it documented somewhere.
Dovecot is a POP3 / IMAP mail server for Linux systems, used extensively by small businesses and ISPs.
I had a problem recently after adding a Linux user, which was this: I couldn’t log in as the new user to collect mail. Mail was being delivered correctly to the right location, e.g.:
/var/mail/new_user
…but dovecot wouldn’t let me log in to check it. I could see the following errors in my maillog:
dovecot: POP3(new_user): mail_location not set and autodetection failed: Mail storage autodetection failed with home=/home/new_user dovecot: POP3(new_user): Fatal: Namespace initialization failed
Trying to use the PHP mail client SquirrelMail I was getting this: “ERROR: Connection dropped by IMAP server”.
Simply trying to telnet into port 110, I was getting this, after entering the correct password: “Connection closed by foreign host”.
Yuk.
After a bit of to’ing and fro’ing, I found that when I created the new user, a mail directory was not being created in the new user’s home directory. Now I don’t recall having to do this in the past, and I’m not sure what’s changed (don’t you hate that?) but this definitely fixed the problem. I even deleted and recreated the new user a number of times to double-check this fixed the problem:
- Go to the new user’s home directory, e.g. /home/new_user
- “mkdir mail”
- change permissions and ownership of this new directory if you need to, e.g.:
- chown new_user:new_user mail
- chmod 700 mail
That’s it!
From this point on, I was able to log in to check mail correctly.
Dovecot was then able to access the directory, which it appears to use to hold imap folders, e.g. /home/new_user/mail/.imap/INBOX and so on.
Like I said, I don’t recall having to go through this manual process of creating a mail directory in the past, obviously something’s changed but it had me pulling my hair out for hours.
Hopefully this helps someone. If not, it will probably help me down the track, and that ain’t bad.
autodetection failed · Connection closed by foreign host · Connection dropped by IMAP server · dovecot · linux
24
What’s been happening?
No comments · Posted by Dr Ron in Blogging, HTC, Internet, On-air, Personal, Social Networking, TTR, Technical, Web 2.0
Woooaah … truckloads.
There are 1001 blog-worthy things to blog in my blog about.
Sadly, time (lusty and blithe) is at his apogee.
In brief, I have:
- Had a shave, since the last blog post;
- Upgraded The Surgery WordPress blog from 2.8.3 to 2.9;
- Moved WordPress blog from Fedora 9 machine with crappy dynamic IP address (it was killing me) to shiny Fedora 11 machine with static IP address;
- Marveled at my ability to upgrade WordPress, SQL databases and move them across Linux machines, AND make grown-up changes to DNS zone files – am surely a guru of such things now and legend in my own lunchbox;
- Undertaken 2 of 8 Tech Talk Radio Summer Series productions, time-consuming but rewarding;
- Upgraded the HTC Dream / Google phone to the next Android operating system, very successful;
- Teetered on the brink of e-mail bankruptcy;
- Ordered a new PC for Christmas;
- Ventured inside an Apple Store for the very first time, and escaped by making only a minor purchase (a new iPod Touch); and
- Just today, assisted Mrs Dr Ron in restoring her iTunes library, after she deleted all the music files from her PC’s hard disk - successfully achieved restoration by using a third-party app called iRip which we’ve spoken about on Tech Talk in the past (thanks JD, saviour of Dr Ron’s marriage).
I have also Tweeted mercilessly about our well-intentioned (yet incompetent, foolish and mis-informed) Senator for Communications and the Digital Economy, Stephen Conroy. In case you hadn’t caught up with the news (which the good Senator saved until after the last live episode of Tech Talk for 2009), Australia will be ranked highly with the United Arab Emirates, Iran and China in its foolish deployment of an ISP-based Net Filter.
Adam Turner has had a lot to say about this, and made a clever analogy with a different type of infrastructure. His blog posts here and here in The Age last week should be mandatory reading.
I’ll blog in more detail about these and other things soon.
I hope you have a great Chrissy and a safe and prosperous New Year.
#nocleanfeed · adam turner · andorid · apple · apple store · blog · fedora · Google Phone · HTC Dream · ipod touch · irip · linux · net filter · news · stephen conroy · tech talk · Tech Talk Radio · the age · the age tech · updates · what's happening · wordpress
