Node-SMB / marsaud-smb2

SMB2 Client
53 stars 46 forks source link

Domain name for local network samba? #81

Closed dnm13 closed 2 years ago

dnm13 commented 2 years ago

I'm sorry if this is not really an issue, more like a normal question due to my inexperience.

But what to fill in domain in the constructor, if your target share is from a local network? How do you get the domain of a local (LAN) shared?

My PC (client) is a Windows 10, trying to connect to samba from linux through local network.

import samba from '@marsaud/smb2'

let client = new samba({
    share: '\\\\192.168.100.3\\book1',
    domain: 'Domain', // <----- ??
    username: 'dnm13',
    password: 'thisisapassword',
});
julien-f commented 2 years ago

IIRC, the default domain is WORKGROUP.

dnm13 commented 2 years ago

IIRC, the default domain is WORKGROUP.

Hi julien, thanks for replying!

I've already tried that. It throws error belows:

  Error: STATUS_LOGON_FAILURE (0xC000006D) : The attempted logon is invalid. This is either due to a bad username or authentication information.
    at SMB2Forge.request (D:\test\node_modules\@marsaud\smb2\lib\tools\smb2-forge.js:22:15)
    at D:\test\node_modules\@marsaud\smb2\lib\tools\smb2-connection.js:108:11
    at Object.<anonymous> (D:\test\node_modules\@marsaud\smb2\lib\tools\message.js:15:15)
    at Socket.<anonymous> (D:\test\node_modules\@marsaud\smb2\lib\tools\smb2-forge.js:71:31)
    at Socket.emit (events.js:315:20)
    at addChunk (_stream_readable.js:309:12)
    at readableAddChunk (_stream_readable.js:284:9)
    at Socket.Readable.push (_stream_readable.js:223:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23) {
  messageName: 'session_setup_step2',
  params: {},
  code: 'STATUS_LOGON_FAILURE'
}

There's no mistake in username and password, that's for sure. The share itself looks like this in explorer image So I believe there's also no mistake in share input. Is there a way to check the domain manually?

dnm13 commented 2 years ago

image samba's workgroup is indeed the default "WORKGROUP". So why it doesn't work? where did I go wrong?

julien-f commented 2 years ago

I don't know, I'm sorry and I don't have time to investigate your issue.

dnm13 commented 2 years ago

I don't know, I'm sorry and I don't have time to investigate your issue.

ah it's okay. thank you for trying :)

dnm13 commented 2 years ago

I'm not sure why or how, but got it fixed by adding this inside my samba conf file:

[global]
ntlm auth = yes

Closing this issue due to being solved, and irrelevant to the module (so sorry!)

julien-f commented 2 years ago

@dnm13 No worries, also thank you for posting your solution, it may help someone else :slightly_smiling_face: