1

I'm using this command for testing the SMB connection:

smbclient -A=credential_file -L \\hostname  


    Sharename       Type      Comment
    ---------       ----      -------
    ADMIN$          Disk      Remote Admin
    C$              Disk      Default share
    Acme            Disk
    Acme Directory  Disk
    Share           Disk
SMB1 disabled -- no workgroup available

I can explore the Acme directory because there isn't space in its name with this command :

smbclient -A=credential_file \\\\hostname\\Acme -c "dir"

but if I want to explore the directory Acme Directory with these command as example I've error message

smbclient -A=credential_file \\\\hostname\\Acme\ Directory -c "dir"
NT_STATUS_ACCESS_DENIED listing \*

smbclient -A=credential_file \\\\hostname\\Acme\%20Directory -c "dir"
tree connect failed: NT_STATUS_BAD_NETWORK_NAME

How to explore directory with space in its name ?

dubis
  • 1,430
  • 2
  • 18
  • 31
  • 1
    I know little about Samba. Are you sure `NT_STATUS_ACCESS_DENIED` means there is a problem with the name? In the last case there was a problem with the name and you got `NT_STATUS_BAD_NETWORK_NAME`. – Kamil Maciorowski Apr 25 '23 at 12:17
  • Perhaps the apparent space is some other character, like non-breaking space? Try passing the `-L` output through `cat -t`. Note, you can use "/" instead of backslash in the cli, and then don't need to escape, eg: `smbclient //hostname/Acme`. – meuh Apr 26 '23 at 13:45
  • You can use slash in the fstab file configuration for mounting the cifs but not with smbclient. In the fstab file, I use the ascii code `\040` in place of the space like `//hostanme/directory1\040Super\040Directory`. I mean the backslash is used for mark a special character and in this case it's backslash. It's the reason there are 4 backslash before the hostname. – dubis Apr 27 '23 at 14:53

0 Answers0