We are running Debian wheezy, with smbclient v 3.6.6, trying to reach a Windows 2012 R2 share.

This conundrum involves two users: ReadOnlyUser and WriteUser

We have been using -A (--authentication-file) to reach our windows shares from this box for years in order to automate many file transfer jobs against various Windows shares, sftp, and web endpoints. I can use the -A option to log in with the ReadOnlyUser against this share without difficulty.

smbclient '//server.domain/share' -A ReadOnlyUser.auth

I can use -U to log in with the WriteUser if I provide the password in response to the prompt interactively.

smbclient '//server.domain/share' -U WriteUser

However, when I try to provide an authentication file with the WriteUser credentials, I get this error: session setup failed: NT_STATUS_LOGON_FAILURE

The authentication files look like this:

username = WriteUser
password = 3iDPCAWmdiAQxTn3
domain = mydomain

I checked in our AD to make sure that the two users are identical in all other respects.


It is a known issue which has been reported on https://bugs.launchpad.net/ubuntu/+source/samba/+bug/1318835

The symptom of smbclient seems to ignore the "domain" section in your credentials file, so that -A doesn't override /etc/samba/smb.conf。The workaround based on the issue report is you have to modify WORKGROUP in smb.conf:

workgroup = mydomain

So that you can keep using -A to access SMB server.

Hope this helps.


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:


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.