Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I add users to my server with the command useradd -m -p PASS_HASH -s /usr/sbin/nologin USERNAME Then I try to access their samba home share, but it never shows up until I login with the user:

root:~$sudo login failtest
Password:######
Added user failtest.

Is there some way of added the user without logging in?

Edit: The problem is that the user is added with the useradd command, but ubuntu seems to run an initalisation script when the user logs on for the first time. This script then adds that user to the tdbsam user database. Finding the initalisation script or the method it uses to add a user to the tdbsam database without requiring any user input (as smbpasswd -a USER prompts the user for a password).

So all I need is a way to add a user+pass to the tdbsam database without prompting a user for a password (eg: samaba-add-user.sh USERNAME PASSWORD).

share|improve this question
add comment

3 Answers

I believe that you can solve this by using "adduser" instead of "useradd". The adduser script should create the rest of the stuff you're looking for.

share|improve this answer
    
I checked the adduser script (though my perl understanding is limited) and I couldn't see it doing anything different. I guess what I need to find out is what ubuntu does when a user logs in for the first time –  glisignoli Sep 22 '10 at 1:54
    
I have just tried using the adduser command and it hasn't made any difference. I still have to login to be able to use that account with samba. –  glisignoli Sep 22 '10 at 2:27
add comment

My gut is a PAM-related issue. Does the user's home directory exist before they log in, or are you relying on pam_mkhomedir to create the directory and pull in skel? If you are using pam_mkhomedir, is it configured correctly in your PAM config for samba?

Can you post your whole PAM config, if you wouldn't mind?

share|improve this answer
add comment

This is because samba is syncing with passwd after the user logs in. If you want the user to be able to login to samba, before doing any shell logins, run smbpasswd -a failtest after creating the user. This will add the proper entry to the dbsam.

You can also use the pdbedit utility to do it manualy.

share|improve this answer
add comment

Your Answer

 
discard

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.