The problem

We have a NAS, which I can easily mount via CIFS, but I cannot access it via smbclient. On the NAS itself I have very little influence. I just got a permission for a set of shares there.

What works

The mount via fstab works flawlessly via

//nasname.local/someshare /mnt/someshare cifs credentials=/home/.cifs/cifscredentials,iocharset=utf8,dir_mode=0777,file_mode=0777 0 0

I can also list the shares via smbclient via smbclient -L //nasname.local/ -N when i log in anonymously

Anonymous login successful

    Sharename       Type      Comment
    ---------       ----      -------
    IPC$            IPC       IPC Service (NAS Server)
    Backup          Disk      
    Public          Disk      System default share
    Web             Disk      System default share
Reconnecting with SMB1 for workgroup listing.
Anonymous login successful

    Server               Comment
    ---------            -------

    Workgroup            Master
    ---------            -------
    WORKGROUP            xxx

What doesnt work

I take now the same credentials to log into the NAS via smbclient smbclient //nasname.local/someshare -U username and the the password, but I get the response

Enter WORKGROUP\username's password: 
tree connect failed: NT_STATUS_ACCESS_DENIED

So I'd like to know, what the problem could be, that a cifs-mount works but a connection via smbclient doesnt.

Solution c.f. further below

  • When you mount it, can you see the contents of that top-level folder? Or doyou have to cd to a subfolder that you have permissions on? – L. Scott Johnson Apr 24 '20 at 12:32
  • You mean, to directly mount mount //nasname.local/ instead of mount //nasname.localWeb/? If yes, then it doesn't work, to directly mount the top-level folder. I have to directly specifiy the service name as do mount -t cifs -o credentials=~/.cifs //nasname.local/Web /mount/dir/ – physicus Apr 27 '20 at 14:46
  • 1
    Thx to your comment, i looked again into my issue, and was able to solve it. I'll post the solution to my orignal post. – physicus Apr 27 '20 at 14:57

I was now able to get it work via

  • Providing the credentials in a file, looking like
    username = my_user_name
    password = my_secret_password
  • calling the smbclient via
    smbclient //nasname.local/Web -A /my/credentials/file

And it's important, that in the file on uses username instead of only user (eventhough the latter works if one mounts via sudo mount -t cifs)

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.