36

I'm running smbclient on Ubuntu, trying to connect to a Windows box, and I'm getting "session setup failed: NT_STATUS_LOGON_FAILURE".

I've verifed that I can ping the box and telnet to ports 139/445, so I'm pretty sure that it's not a firewall issue. And my client says that they can connect to this Windows box from another Windows box with the userid/password combination without issue. Also, this box can connect via smbclient to other Windows boxes that this client has.

Any other ideas for why this isn't working?

6 Answers 6

41

Have you checked your smb.conf?

Make sure your workgroup and security settings are properly set. If you are working with a a computer as part of a domain, authentication requests are first passed through your domain controller, so make sure you have something similiar to:

security = domain
workgroup = WORKGROUP

You can also use the -W option to specify the workgroup, and add DOMAIN/ before your username to specify the domain:

$smbclient -L myhost -U DOMAIN/user -W workgroup

Hope this helps!

7
  • Turns out adding the domain did the trick. Apparently some versions of Windows require the domain and others don't? But, thanks! Mar 3, 2012 at 19:03
  • note that the 'security = domain' bit is unnecessary here. Apart from specifying the workgroup in smb.conf, you can also specify it on the command line to smbclient.
    – jelmer
    Mar 3, 2012 at 20:09
  • Yes, the -W option to smbclient is what I used to get it working. Mar 5, 2012 at 2:16
  • 7
    DOMAIN/username should also work.
    – Calmarius
    Apr 5, 2013 at 15:36
  • 1
    You may also use smbclient with the -W argument. Jan 27, 2015 at 17:09
9

Same issue. I had to add users to the Samba password file with

sudo smbpasswd -a

Apparently this is because the default configuration in /etc/samba/smb.conf is

security = user

passdb backend = tdbsam

I’m not using domain controllers or active directory, so I would have thought that access to the regular password file would be the default, but I guess not. It would be nice if that were clear in the documentation I found. The “smbpasswd” reference provided a hint that led to this solution.

1
  • I'm on a domain, and this is the way i think i will have to do this because i don't use my domain user on Linux, its a personal development Linux guest on a windows host. Further, I am now able to successfully connect to smbclient -L localhost on the guest, but not yet able to connect using the windows host. I think this was at least one step forward. I think its ports from here you should include the port numbers to check for in your answer. Aug 16, 2017 at 22:39
2

I was having the same problem with smbclient, and I noticed that it went away when I manually selected the "Just Enable File Sharing" option on the File Sharing dialog you get after manually right-clicking on the folder you want to share.

In some Windows machines (like Windows XP) you need to add this to permit remote sharing for non guest users:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa\forceguest=dword:0

or, automating using the windows xp command line:

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Lsa" /v forceguest /t REG_DWORD /d 00000000 /f

After that, smbclient worked without any problems with any user.

Many thanks to jethomas in http://www.techsupportforum.com/forums/f10/enable-file-sharing-via-the-command-line-133562.html

2

On Windows 10 (host) and CentOS 7 (guest) I was able to fix the authentication problem by turning off password protected sharing: Network and sharing center / Advanced sharing settings / all networks / Password protected sharing

This can be helpful for troubleshooting only, I would not recommend keeping it off for everyday use.

1

I got the same problem when I ran

smbclient \\\\[ip]\\[sharedresource]

That command asks me to enter password for a root user, however when I entered the password, I received the NT_STATUS_LOGON_FAILURE error.

I added -U to specify my remote machine's username and it worked

smbclient \\\\[ip]\\[sharedresource] -U [username]
0

This may be due to following reason:

  1. If valid users is provided in smb.conf cross check the smbpasswd
  2. Check the hosts file.
1
  • Not sure why this got down-voted. This answer pointed me to smbpasswd which is what I needed to use to set credentials when I was getting this same error. Oct 5, 2015 at 20:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .