0

When i try to connect to the location directly using the smbclient I get "NT_STATUS_BAD_NETWORK_NAME".

naveenp@LTIN123456:~$ smbclient //sambahost/folder1/folder2/folder3 -U username@sambahost -m SMB2
Password for [username@sambahost]:
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

where as when i connect to one of the folder in the root of the samba, I can get into and can access the file with cds.

naveenp@LTIN123456:~$ smbclient //sambahost/folder1/ -U username@sambahost -m SMB2
Password for [username@sambahost]:
Try "help" to get a list of possible commands.
smb: \> cd folder2\folder3\
smb: \folder2\folder3\> ls
  .                                   D        0  Wed Sep 27 17:29:23 2023
  ..                                  D        0  Wed Sep 27 17:29:23 2023
  File09-27-2023_03-09-04.csv      A   479638  Wed Sep 27 12:30:22 2023
            129184287 blocks of size 65536. 23724791 blocks available

smb: \folder2\folder3>

I'd like to know what could be the reason and workaround for this to get into the directory directly. Thanks very much in advance for all your inputs.

Naveen
  • 103

1 Answers1

1

smbclient requires the "servicename" of an SMB resource (the shared folder) in //server/service format. A specific initial directory can be specified with -D|--directory:

smbclient //sambahost/folder1/ -D folder2/folder3 -U username@sambahost -m SMB2
Cpt.Whale
  • 10,914