Node-SMB / marsaud-smb2

SMB2 Client
53 stars 46 forks source link

ACCESS_DENIED #18

Open DaVinciLord opened 7 years ago

DaVinciLord commented 7 years ago

I tried to list all the files in a Windows Share but couldn't, the SMB2 object has this value: connected: false

Here is a fiddle of my code:

var SMB2 = require('@marsaud/smb2');
let smb2Client = new SMB2({
  share: '\\\\192.168.17.200\\utilisateurs',
  domain: 'domain',
  username: 'username',
  password: 'password',
  port: 445,
});

smb2Client.readdir('.', (err, files) => {
  if (err) throw err;
  console.log(files);
});

And the error stack

Error: STATUS_ACCESS_DENIED (0xC0000022) : {Access Denied} A process has requested access to an object but has not been granted those ac
cess rights.
    at Object.03000000 (/home/davincilord/test/test-smb/node_modules/@marsaud/smb2/lib/tools/message.js:25:21)
    at Socket.<anonymous> (/home/davincilord/test/test-smb/node_modules/@marsaud/smb2/lib/tools/smb2-forge.js:72:31)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at readableAddChunk (_stream_readable.js:176:18)
    at Socket.Readable.push (_stream_readable.js:134:10)
    at TCP.onread (net.js:551:20)
julien-f commented 7 years ago

AFAIK, this library requires all permissions (even admin) on the share, maybe that's the issue?

DaVinciLord commented 7 years ago

I tested with admin permissions on the share, didn't work either.

olivierlambert commented 7 years ago

Can you show exactly the permission panel in your Windows for this share?

IIRC, there is 2 kind of permissions:

Obviously, one of them is not high enough to allow an access

DaVinciLord commented 7 years ago

Tested with a Python script, from linux command line (using mount -t cifs) and with https://github.com/eflexsystems/node-samba-client and both worked (connected and listed files).

I should add that I use a Linux OS.

olivierlambert commented 7 years ago

You mean your SMB server is a Linux host?

DaVinciLord commented 7 years ago

Nope, the SMB server is on Windows. I just have a Linux client for the SMB (my nodejs application is on a linux server).

olivierlambert commented 7 years ago

Okay so take a look at your Windows host, both for NTFS and share level permissions.

edit: if we can find the exact permission level that is not necessary to switch on, I think we could ask @marsaud to take a look and fix this (if there is no good reason to ask for those extended permissions)

DaVinciLord commented 7 years ago

The Windows Share is indeed in NTFS so I think it's good. As for the share level permissions, I could only do a screen of this panel: capture

I use the "Administrateur" account to log in.