Samba troubleshooting : NT_STATUS_BAD_NETWORK_NAME

Tip : if you’ve configured a samba server and you know you configuration should work, but you can’t connect from a Windows server, try to run smbclient from a linux server.

You will have more information to work with.

Try to run :

# smbclient –L myhost1 –U myusername

Domain=[ myhost1] OS=[Unix] Server=[Samba 3.5.6-86.el6]

Sharename       Type      Comment

---------       ----      -------

sqldump Disk      dumps sql

IPC$            IPC       IPC Service (Samba Server Version 3.5.6-86.el6)

Domain=[ myhost1] OS=[Unix] Server=[Samba 3.5.6-86.el6]

Server               Comment

---------            -------

Workgroup            Master

---------            -------

 

For instance the share sqldump should be ok to connect with but when I try to connect with smbclient, I get the following error:

tree connect failed: NT_STATUS_BAD_NETWORK_NAME

 

Try to disable SELinux, even temporarly with :

echo 0 > /selinux/enforce

And try again, it should work.

 

For more information on how to disable SELinux try this link:

http://www.crypt.gen.nz/selinux/disable_selinux.html

Using smbclient – Utilisation de smbclient

smbclient is useful alternative to ftp, sftp and smbmount if you want to access to a Windows environment from Linux, because :

smbmount : you have to be root (or configure sudo)

ftp : secure Windows and Linux won’t have active ftp server.

sftp : you have to install a client on Windows.

smbclient est une alternative bien utile à ftp, sftp et smbmount pour accéder à un environnement Windows depuis Linux, car :

smbmount : il faut être route (ou mettre en place sudo)

ftp : les Windows et Linux sécurisés n’ont pas de server ftp actif.

sftp : il faut installer un client sur Windows.

 

Using smbclient with example :

Utilisation de smbclient en exemple :

Show the share on the Windows:

Affichage des partages Windows :

$ smbclient -L myhost -U myusername

Password:

Domain=[FRTS0072] OS=[Windows Server 2003 R2 3790 Service Pack 2] Server=[Windows Server 2003 R2 5.2]

Sharename       Type      Comment

---------       ----      -------

IPC$            IPC       Remote IPC

C$              Disk      Default share

ADMIN$          Disk      Remote Admin

D$              Disk      Default share

E$              Disk      Default share

Domain=[myhost] OS=[Windows Server 2003 R2 3790 Service Pack 2] Server=[Windows Server 2003 R2 5.2]

Server               Comment

---------            -------

Workgroup            Master

---------            -------

Connecting, browsing, uploading and downloading:

Connexion, navigation, téléchargement :

 

$ smbclient //myhost/C$ -U myusername

Password:

Domain=[myhost] OS=[Windows Server 2003 R2 3790 Service Pack 2] Server=[Windows Server 2003 R2 5.2]

Listing files on Windows – Liste des fichiers sur le Windows

smb: \> ls

AUTOEXEC.BAT                        A        0  Fri Oct  9 19:06:19 2009

boot.ini                          AHS      222  Fri Oct 16 10:19:18 2009

CONFIG.SYS                          A        0  Fri Oct  9 19:06:19 2009

Documents and Settings              D        0  Fri Oct  9 19:12:22 2009

Intel                               D        0  Fri Oct  9 19:25:08 2009

IO.SYS                           AHSR        0  Fri Oct  9 19:06:19 2009

MSDOS.SYS                        AHSR        0  Fri Oct  9 19:06:19 2009

NTDETECT.COM                     AHSR    47772  Wed Mar 22 13:00:00 2006

ntldr                            AHSR   297072  Fri Oct  9 19:54:49 2009

OpenManage                          D        0  Sat Feb 19 11:01:23 2011

pagefile.sys                      AHS 2145386496  Sat Feb 19 11:21:26 2011

Program Files                      DR        0  Sat Feb 19 10:50:13 2011

Program Files (x86)                DR        0  Sat Feb 19 11:05:04 2011

RECYCLER                          DHS        0  Wed Mar 24 18:34:18 2010

System Volume Information         DHS        0  Fri Oct  9 19:12:09 2009

WINDOWS                             D        0  Sun Mar 27 03:02:58 2011

34683 blocks of size 2097152. 28612 blocks available

Listing local files – Liste des fichiers locaux

smb: \> !ls

mnt  pscp.exe

Upload file – Upload d’un fichier

smb: \> put pscp.exe

putting file pscp.exe as \pscp.exe (8470.6 kb/s) (average 8470.6 kb/s)

smb: \> pwd

Current directory is \\myhost\C$\

Download a file – Téléchargement d’un fichier

smb: \Documents and Settings\Administrator\Desktop\old_log\> get cfg3CPU.log

getting file \Documents and Settings\Administrator\Desktop\old_log\cfg3CPU.log of size 47472 as cfg3CPU.log (5151.0 kb/s) (average 8426.8 kb/s)

smb: \Documents and Settings\Administrator\Desktop\old_log\> exit