# NT_STATUS_BAD_NETWORK_NAME error when setting up Samba

## TinyGrasshopper

Hello, I wanted to setup folder and print sharing using Samba so I followed this howto basically to the letter and at the end of it I got this when I try to check whether the folders are being shared

$ smbclient -L localhost

Password:

Domain=[MSHOME] OS=[Unix] Server=[Samba 3.0.28]

tree connect failed: NT_STATUS_BAD_NETWORK_NAME

Does anyone have any insight into this? I'd appreciate any help.

----------

## ito717

Odd.  A few things to try to see whats going on...

Can you 'ping localhost'?  If something is fudged up with /etc/hosts, localhost might not be resolving properly.

What happens if you try 'smbclient -L ipaddress' where ipaddress is the ip address of eth0 or whatever your primary ethernet interface is?

Since you aren't appending the -u option to smbclient to set the username, it will use the name your shell is running as.  Does this user have an smbpasswd?

These are the things I'd try first to see what is going on.  Since you are not getting NT_STATUS_CONNECTION_REFUSED, it seems that the samba service is up and running.

----------

## TinyGrasshopper

I can ping localhost

When I do smbclient -L ipaddress it gives me the same error

There are only two users on the machine, root and the regular user and they both have smbpasswds

I don't know what I'm talking about here, but I thought it could have something to do with the domain name that the machine is set to, which is to say none. I tried to change it earlier but when I login it still says servername.unknown_domain

----------

## pappy_mcfae

1) did you setup your samba password using smbpasswd?

2) is your /etc/hosts file set up propery?

3) are you using DHCP or static IP addresses?

4) is your /etc/samba/smb.conf simple, or full of extra fluff?

The error you give happens when there's a password problem or IP address problem. As a general rule, samba likes static IP addresses. I shudder to consider setting it up on a pure DHCP system.

Your hosts file needs to reflect the name and IP address of each machine you want to use the shares. Security is also another concern that is helped by static IP addresses as well.

Check the items above. I think you'll find some problems.

Blessed be!

Pappy

----------

## TinyGrasshopper

All the users on the system have an samba password set using smbpasswd.

I'm not sure what you mean by set up properly for the /etc/hosts but it looks fine to me. my hosts file has the following:

127.0.0.1          localhost localhost.localdomain

::1                   localhost

192.168.1.103   gaming-desktop

192.168.1.104   laptop1

192.168.1.101   laptop2

#Machine in question

192.168.1.107   bobs-server bobs-server.MSHOME

I'm using a static address on the samba server, not on the other machines in the network. The other machines are dhcp. I would change them but I got a bug in kubuntu in switching to static addresses and the other two machines are laptops.

My /etc/samba/smb.conf only contains stuff that was described in the howto. When I run testparm I get the following

Load smb config files from /etc/samba/smb.conf

Processing section "[print$]"

Processing section "[HP_Photosmart_C3100_series_USB_1]"

Processing section "[printers]"

Processing section "[public]"

Processing section "[bob]"

Loaded services file OK.

WARNING: You have some share names that are longer than 12 characters.

These may not be accessible to some older clients.

(Eg. Windows9x, WindowsMe, and smbclient prior to Samba 3.0.)

Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

[global]

        workgroup = MSHOME

        netbios name = BOBSSERV

        server string = Samba Server-%h-%v

        interfaces = lo, eth0

        bind interfaces only = Yes

        security = SHARE

        log file = /var/log/samba/log.%m

        max log size = 50

        socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

        printcap name = cups

        show add printer wizard = No

        vscan-clamav:config-file = /etc/samba/vscan-clamav.conf

        guest ok = Yes

        hosts allow = 127.0.0.1, 127.0.1.1, 192.168.1.0/24

        hosts deny = 0.0.0.0/0

        printing = cups

        print command =

        lpq command = %p

        lprm command =

        vfs objects = vscan-clamav

[print$]

        comment = Printer Drivers

        path = /etc/samba/printer

        write list = bob, root

[HP_Photosmart_C3100_series_USB_1]

        comment = HP Photosmart C3180 series USB

        path = /var/spool/samba

        printable = Yes

[printers]

        comment = All printers

        path = /var/spool/samba

        create mask = 0600

        printable = Yes

        use client driver = Yes

        browseable = No

[public]

        comment = Public Files

        path = /home/samba/public

        create mask = 0766

[bob]

        comment = bob's home folder

        path = /home/bob

        create mask = 0766

----------

## pappy_mcfae

 *TinyGrasshopper wrote:*   

> All the users on the system have an samba password set using smbpasswd.
> 
> I'm not sure what you mean by set up properly for the /etc/hosts but it looks fine to me. my hosts file has the following:
> 
> 127.0.0.1          localhost localhost.localdomain
> ...

 

Yes, that is fine. 

 *Quote:*   

> I'm using a static address on the samba server, not on the other machines in the network. The other machines are dhcp. I would change them but I got a bug in kubuntu in switching to static addresses and the other two machines are laptops.

 I'd say therein lies the problem. Samba really likes to have static IP addresses. I went nuts trying to figure that wondrous little foible out. One day samba would work, the next day, no dice. It was enough to make me want to throw all my machines out the window, and start fresh...or find a new hobby.

Once I changed all the machines (the Linux and the Windoze) to use static IP addresses, my numerous samba glitches went the way of the XT.

 *Quote:*   

> My /etc/samba/smb.conf only contains stuff that was described in the howto. When I run testparm I get the following
> 
> Load smb config files from /etc/samba/smb.conf
> 
> Processing section "[print$]"
> ...

 While testparm can test the /etc/samba/smb.conf for syntactical correctness, being correct syntactically isn't the same as providing functionality. There are certain settings in samba that can do some weird things unless you know exactly what you are wanting it to do.

Therefore, the idea when setting up your /etc/samba/smb.conf is keep it simple. The /etc/samba/smb.conf below is what I use on a daily basis. It works on all three machines. And while I can't rightly say whether or not it makes my system secure, there is no doubt that it does work.

```
# Samba config file created using SWAT

# from 127.0.0.1 (127.0.0.1)

# Date: 2007/10/13 02:34:25

[global]

   security = SHARE

   root directory = /

   log file = /var/log/samba.%m

   max log size = 50

   min protocol = NT1

   max protocol = NT1

   server signing = auto

   printcap name = cups

   preferred master = No

   local master = No

   domain master = No

   dns proxy = No

   ldap ssl = no

   hosts allow = 192.168.0.100, 192.168.0.115, 192.168.0.120, 192.168.0.125, 192.168.0.130, 127.0.0.1

   hosts deny = ALL

   printing = cups

   print command = 

   lpq command = %p

   lprm command = 

[printers]

   comment = All Printers

   path = /var/spool/samba

   guest ok = Yes

   printable = Yes

   browseable = No

[homes]

   comment = Home Directories

   path = /

   read only = No

```

As you can see, it's significantly more compact than yours. Please, use it as a guide to simplification of yours.

Working with samba can be tricky. Having any dhcp machines only makes it trickier, and less secure. I think the place to start is to find a work-around for the static IP address problem with kubuntu.

Blessed be!

Pappy

----------

## TinyGrasshopper

 *TinyGrasshopper wrote:*   

> 
> 
>         vscan-clamav:config-file = /etc/samba/vscan-clamav.conf
> 
>         vfs objects = vscan-clamav
> ...

 

I think my problem was these two lines in the smb.conf. The problem seemed to be fixed. I re-emerged samba and then disabled these two lines and it worked.

I'm fine with it as it is because of the overhead of running clamd on my old machine isn't worth it. This begs the question of what the line is supposed to be to get the virus scanning in samba using clamd.

Is this something that the howto author should be informed of?

----------

## danomac

Yes, the author should be informed of that. The 'oav' USE flag was dropped a while ago (this is the inline clamav support) because it was no longer maintained. That probably explains why it wasn't working.

Edit: I reproduced it on my workstation, and then filed a bug. I'm sure they'll fix it when they have time.

----------

## zvn

 *danomac wrote:*   

> The 'oav' USE flag was dropped a while ago (this is the inline clamav support) because it was no longer maintained. That probably explains why it wasn't working.

 

I'm find this information about mantainer on Official OpenAntiVirus.org Projects page:

http://www.openantivirus.org/projects.php

 *Quote:*   

> 
> 
> If you're using Samba 3.0.25 (or later), please give 0.3.6c Beta5 a try. samba-vscan is maintained by Rainer Link.
> 
> 

 

Latest patch is

http://www.openantivirus.org/download/ 15-Sep-2007 07:49 samba-vscan-0.3.6c-beta5.tar.gz

Could this flag be returned?

----------

