Sunday, March 28, 2010

To add a new user into Samba server

Have you ever had problem accessing a remote Linux machine from your windows, but Windows (XP/etc.) keeps asking for password (in other word, our account is always denied)? If you have, most likely is that our Linux server doesn't have the credentials to allow such username.  This occurs if we don't use PDC.

When you check the log (/var/log/samba/log.*), you would find something like this:


[2010/03/28 23:26:35,  1] smbd/service.c:676(make_connection_snum)
  create_connection_server_info failed: NT_STATUS_ACCESS_DENIED


The following simple command will create a new user in Samba server (e.g, "newuser" should match with the user in the Linux machine managed by PAM module).


mnt$ sudo smbpasswd -a -U newuser
New SMB password:
Retype new SMB password:
Added user newuser.

Now, from Windows explorer, we can just type "\\linuxserver\newuser".  It will then ask for password.  Use the password we entered above.