# Network-NetBIOS-SAMBA issues



## JGUK (Mar 1, 2009)

First I apologise for starting this thread.  I have been working on this for 4 consecutive weekends and need some pointing in the right direction.  I have read the installation and how to manuals. I think the reason I am not "getting it" is the difference in nomenclature and since FreeBSD must meet a multitude of configurations - I am having trouble diciphering which settings are best for this application. Also, I haven't fully absorbed the nuances or architecture of FreeBSD 6.4.

My system is a Dell PE1600SC server, dual Xeons, 256Mb memory. FreeBSD is installed on an adaptec RAID 5. It is in a private network (10.0.0.x). The router/hub/dsl/wireless assigns the IP address and has a firewall - all I want the server to do right now run samba then apache then sendmail for a start.

I have been running the original factory installed Linux 9 since October 2003 (5.5 years!) without any (known) problems. The linux installation is on its own (separate from the Adaptec RAID 5) IDE drive. I know that someday the Linux HD will fail, which led me to FreeBSD 6.4 because it is the lastest "solid" configuration (am I wrong?). 

So my current configuration has both Hard drives in the box and I switch the BIOS to boot from either the IDE or the PCI (RAID array).  This is not the problem as I originally was switching between both drives by disconnecting one and reconnecting the other however using the BIOS is easier allowing me the max time on the weekends to work this problem. I can only work this issue over the weekend because the business needs the server during working hours M-F.

All I want to do is provide the same services that my Linux configuration is providing namely (in priority);

1) SAMBA
2) SAMBA
3) Did I mention SAMBA?
4) Apache
5) SendMail

Because I am a FreeBSD/Network/Server dimwit I thought I could do the configuration but I am giving up to the greater FreeBSD community for help - please!  Here is my situation.

1) SAMBA not allowing me to log on on an x-terminal in a FreeBSD environment here is what I get:

smbclient //This_Server_01/username
Password: 
session setup failed: NT_STATUS_LOGON_FAILURE

I collected information from a Samba-howto-with-FreeBSD and it said to turn on NetBIOS in the inetd.conf file so I did - NOW I have got errors coming from the main terminal.  The errors are:

netbios-ssn/tcp: bind: Address already in use
netbios-ns/udp: server failing (looping in use)

so there is a conflict but because I am a dimwit I do not know what is conflicting with what. (Can someone please help?)

I did check this on this forum and everyone asked for a netstat -a so here is mine:


$ netstat -a
Active Internet connections (including servers)
Proto Recv-Q Send-Q  Local Address          Foreign Address        (state)
tcp4       0      0  localhost.x11-ssh      localhost.53665        ESTABLISHED
tcp4       0     40  localhost.53665        localhost.x11-ssh      ESTABLISHED
tcp4       0      0  localhost.x11-ssh      *.*                    LISTEN
tcp6       0      0  localhost.x11-ssh      *.*                    LISTEN
tcp4       0     84  10.0.0.568.ssh         10.0.0.566.2219        ESTABLISHED
tcp4       0      0  *.swat                 *.*                    LISTEN
tcp4       0      0  *.ssh                  *.*                    LISTEN
tcp6       0      0  *.ssh                  *.*                    LISTEN
tcp4       0      0  localhost.smtp         *.*                    LISTEN
tcp4       0      0  *.netbios-ssn          *.*                    LISTEN
tcp4       0      0  *.microsoft-ds         *.*                    LISTEN
udp4       0      0  *.syslog               *.*                    
udp6       0      0  *.syslog               *.*                    
Active UNIX domain sockets
Address  Type   Recv-Q Send-Q    Inode     Conn     Refs  Nextref Addr
c3b20e10 stream      0      0        0 c3b21000        0        0
c3b21000 stream      0      0        0 c3b20e10        0        0
c3b20000 stream      0      0        0 c3b20090        0        0
c3b20090 stream      0      0        0 c3b20000        0        0
c3b20b40 stream      0      0        0 c3b215a0        0        0
c3b215a0 stream      0      0        0 c3b20b40        0        0
c3b20360 stream      0      0        0 c3b203f0        0        0
c3b203f0 stream      0      0        0 c3b20360        0        0
c3b20480 stream      0      0 c3c34110        0        0        0 /var/db/samba/
winbindd_privileged/pipe
c3b20510 stream      0      0 c3c34440        0        0        0 /tmp/.winbindd
/pipe
c3b206c0 stream      0      0 c3a6bcc0        0        0        0 /var/run/devd.
pipe
c3b20240 dgram       0      0        0 c3b21c60        0 c3b21bd0
c3b202d0 dgram       0      0        0 c3b21cf0        0        0
c3b21bd0 dgram       0      0        0 c3b21c60        0        0
c3b21c60 dgram       0      0 c3bd6110        0 c3b20240        0 /var/run/logpr
iv
c3b21cf0 dgram       0      0 c3bd6220        0 c3b202d0        0 /var/run/log


2) With this FreeBSD configuration up on my network, you cannot explore inside the work group on My Network Place on any windows machine on the same network.  Also you cannot ping anyone on the network. Its as if this server has clamped the network down and I do not know how to unclamp it.

3)xming - a windows ssh server - will only allow you to log on as a user but not as root.

Once I get Samba running correctly I think everything else will fall into place.  My view is I have not setup the network configuration correctly and configure the firewalls and netbios correctly.  If there is infomation that describes this it went right through me.  And I have committed at least 90 hours trying to get this this new FreeBSD going so I know that whatever I am doing is wrong and the answer is probably easy - but as I said - I am dumbstruck.

Sorry for the diatribe but I need some expert - adult help.

Signed,

The Unknowing looking for enlightenment....


----------



## tingo (Mar 1, 2009)

3) you can't login as root. Yes - this is the default (and correct IMHO) way ssh is setup. Get used to it. You can always use su or sudo if you need to be root.


----------



## trev (Mar 1, 2009)

> led me to FreeBSD 6.4 because it is the lastest "solid" configuration (am I wrong?).



FreeBSD 7.1 (Jan 2009) is the latest production release.

FreeBSD 6.4 (Nov 2008) is a "legacy" production release and probably the final release from the RELENG_6 branch.


----------



## gordon@ (Mar 2, 2009)

JGUK said:
			
		

> 1) SAMBA not allowing me to log on on an x-terminal in a FreeBSD environment here is what I get:
> 
> smbclient //This_Server_01/username
> Password:
> ...



I suspect that you have a conflict between the nmbd that is trying to startup normally (via the /usr/local/etc/rc.d/ script) and the inetd started one. Turn off the one in inetd and let it run as a daemon out of the normal startup script.

I would suspect that the LOGON_FAILURE problem probably indicates that you have a problem with the way the passwords are setup. Since smbd can't use your standard Unix logon password, you have to setup passwords separately. I haven't done it on a long time, so I could be wrong here.


----------



## JGUK (Mar 2, 2009)

tingo: I am trying to go headless because the server is in a cold room not at my cozy desk which is why I wanted root priveledges - will look into su and sudo - thanks.

trev: thanks for the info. I burnt the 6.4 disks in october 2008 - just finally got around to it in late Jan early December - because I am not an expert on FreeBSD - I easily fall behind. I believe it would be better to get all the config stuff done on the 6.4 then move to 7.1 or am I wasting my time?

gordon@: I used swat to replace the passwords for each user thinking that would put both together.  How do I verify that the SAMBA are stored in a place that it will retreive it. (ALL - please forgive this question as it is out of context to this forum).

Regarding the rc.d scripts am I right that if samba is in this folder then I do not require a command line in /etc/rc.conf file namely;

samba_enable="YES"



Here is what I have in the /usr/local/etc/rc.d folder:


$ ls -l /usr/local/etc/rc.d
total 40
-r-xr-xr-x  1 root  wheel   472 Sep 15 16:21 001slpd.sh
-r-xr-xr-x  1 root  wheel   661 Sep 25 18:49 apache.sh
-r-xr-xr-x  1 root  wheel   873 Sep 15 20:51 avahi-daemon
-r-xr-xr-x  1 root  wheel  1119 Sep 15 20:51 avahi-dnsconfd
-r-xr-xr-x  1 root  wheel   508 Nov 19 15:24 cupsd
-r-xr-xr-x  1 root  wheel   662 Sep 15 20:11 dbus
-r-xr-xr-x  1 root  wheel  5061 Sep 19 08:12 fetchmail
-r-xr-xr-x  1 root  wheel   473 Nov 19 14:25 ffserver
-r-xr-xr-x  1 root  wheel  1203 Sep 15 18:00 fusefs
-r-xr-xr-x  1 root  wheel  1404 Sep 15 21:31 hald
-r-xr-xr-x  1 root  wheel   345 Sep 15 17:40 mdnsd
-r-xr-xr-x  1 root  wheel  4895 Nov 19 17:31 samba
-r-xr-xr-x  1 root  wheel  1788 Nov 19 13:42 snmpd
-r-xr-xr-x  1 root  wheel   813 Nov 19 13:42 snmptrapd
-r-xr-xr-x  1 root  wheel   805 Sep 15 19:43 svnserve
-r-xr-xr-x  1 root  wheel   935 Sep 17 15:58 xfs

Heres what I have in the /etc/rc.conf file:

# -- sysinstall generated deltas -- # Wed Feb  4 18:10:22 2009
# added by xorg-libraries port
hostname="This_Server_01.AMYOFFICE"
ifconfig_em0="DHCP"
inetd_enable="YES"
ipv6_enable="NO"
keymap="uk.iso"
#linux_enable="YES"
local_startup="/usr/local/etc/rc.d"
moused_enable="YES"
#nfs_client_enable="YES"
#nfs_server_enable="YES"
#rpcbind_enable="YES"
sshd_enable="YES"
usbd_enable="YES"
samba_enable="YES"
gdm_enable="YES"

The ONLY services I have turned on in inetd.conf is the following;

# Enable the following two entries to enable samba startup from inetd
# (from the Samba documentation).  Enable the third entry to enable the swat
# samba configuration tool.
#
netbios-ssn stream tcp  nowait          root    /usr/local/sbin/smbd    smbd
netbios-ns dgram udp    wait            root    /usr/local/sbin/nmbd    nmbd
swat    stream  tcp     nowait/400      root    /usr/local/sbin/swat    swat

It is when I enabled the netbios-ssn and netbios-ns in the inetd.conf is when I got all the error messages at the terminal.    

ALL- Thank you for your help - The help I need from everyone is my confusion of which config file is doing what because from what I can see you have:

/usr/local/etc/rc.d "folder"
/etc/rc.conf
/etc/inetd.conf

This is my architecture question: which conf file/folder do I use and why? Who has precedence? Why so many places to call up the same thing?  Why are the howto and forum sites providing conflicting info? One says to start samba from inetd.conf, one says to use rc.conf.

So I think I can see that the the netbios calls in the inetd.conf COULD be redundant but what do I use to verify?  I could not interpret the netstat to say that there are two netbios services going or am I missing something?

Also - if you know of links that I missed reading or chapters in the howto manuals please tell me and I will go and do my homework.  I promise!  But I did not see it. Plus I will report on the progress so that some other poor neophite can use the info.

THANKS!!!


----------



## SirDice (Mar 2, 2009)

JGUK said:
			
		

> Regarding the rc.d scripts am I right that if samba is in this folder then I do not require a command line in /etc/rc.conf file namely;
> 
> samba_enable="YES"


If you want samba to start at boot that line in rc.conf is necessary, read /usr/local/etc/rc.d/samba (it's a shell script).




> The ONLY services I have turned on in inetd.conf is the following;
> 
> # Enable the following two entries to enable samba startup from inetd
> # (from the Samba documentation).  Enable the third entry to enable the swat
> ...


Get rid of the entries in inetd. Avoid inetd if possible, it's a legacy from the olden days.


----------



## JGUK (Mar 2, 2009)

*How do I determine if netbios is running?*

SirDice:  OK. I can do that but how do I know those two netbios processes are running?  And do I need them? 

Maybe if I ask a different question;

What needs to be running/shut off in order for this SAMBA server to be seen on the network?  Remember when the server is on in the current FreeBSD configuration, no one can open and "see" anyone on the workgroup area.  It's as if the server has clamped down the network neighborhood workgroup area, which is why I am asking the greater community how do I determine if my configuration is correct?

For example I cannot ping the server IP address from any windows machines, the server does not reply which is why I think there is a network /firewall configuration that comes standard with 6.4 and I need to configure it for my particular application.

I might be mixing apples and oranges here but I cannot find a "top down" troubleshooting sequence that helps me understand that 1) the network is configured properly, 2) the firewall is configured properly (I would like to turn it off for now but how?) then 3) configure SAMBA.  

I can open a SSH xterm on my remote computer bring up opera and surf the outside net but I cannot ping the server from within my own network. :\

It really has to be something obvious and simple and as usual I have overlooked it.....please help (now where is that begging smilie?)


----------



## SirDice (Mar 3, 2009)

JGUK said:
			
		

> SirDice:  OK. I can do that but how do I know those two netbios processes are running?


Add the line to /etc/rc.conf and run (as root) /usr/local/etc/rc.d/samba start.



> What needs to be running/shut off in order for this SAMBA server to be seen on the network?


It needs to be accesseble on the network. I.e. the box will need to have an hostname and ip address. 



> Remember when the server is on in the current FreeBSD configuration, no one can open and "see" anyone on the workgroup area.


Check /usr/local/etc/smb.conf



> For example I cannot ping the server IP address from any windows machines, the server does not reply which is why I think there is a network /firewall configuration that comes standard with 6.4 and I need to configure it for my particular application.


Firewall isn't turned on by default. Make sure the box has an ip address (look in /etc/rc.conf).



> 1) the network is configured properly,


ifconfig, ping localhost, ping <server's ip address>

Forget about the firewall for the time being..


----------



## Ico (Mar 3, 2009)

After you make sure that your server can be seen on the network (i.e. you can ping it/ssh to it from other machines, etc..)

1. Configure Samba (here is my /usr/local/etc/smb.conf)

```
[global]

   workgroup = WORKGROUP      # // workgroup name
   server string = lucy       # // server hostname
   encrypt passwords = yes
   security = user
   hosts allow = 192.168.15. 127.
   load printers = no

#   printcap name = /etc/printcap
#   printcap name = lpstat
#   printing = cups
#   guest account = pcguest

   log file = /var/log/samba/log.%m
   max log size = 100

#   password server = <NT-Server-Name>
#   realm = MY_REALM
#   passdb backend = tdbsam
#   include = /usr/local/etc/smb.conf.%m
#   socket options = SO_RCVBUF=8192 SO_SNDBUF=8192
#   interfaces = 192.168.12.2/24 192.168.13.2/24

   interfaces = 192.168.15.120

   local master = yes
   os level = 99
   domain master = no
   preferred master = no

#   domain logons = yes
#   logon script = %m.bat
#   logon script = %U.bat
#   logon path = \\%L\Profiles\%U
#   wins support = yes
#   wins server = w.x.y.z
#   wins proxy = yes

   dns proxy = no

#   display charset = koi8-r
#   unix charset = koi8-r
#   dos charset = cp866
#   store dos attributes = yes
#   map hidden = no
#   map system = no
#   map archive = no
#   nt acl support = yes
#   inherit acls = yes
#   map acl inherit = yes
#   add user script = /usr/sbin/useradd %u
#   add group script = /usr/sbin/groupadd %g
#   add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
#   delete user script = /usr/sbin/userdel %u
#   delete user from group script = /usr/sbin/deluser %u %g
#   delete group script = /usr/sbin/groupdel %g

   disable netbios = yes

#===== Share Definitions =====
[Unix]
   comment = Unix Share Folder
   path = /usr/HDD
   valid users = jsmith janesmith
   public = no
   writable = yes
   printable = no
   create mask = 0660
   directory mask = 0770
```

2. run # /usr/local/bin/testparm -s to make sure the configuration file is good

3. start samba

```
# /usr/local/etc/rc.d/samba start
Removing stale Samba tdb files: ...... done
Starting nmbd.
Starting smbd.
```

4. if you want to make sure it's running, run # sockstat -4 (here is mine)

```
# sockstat -4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS
root     smbd       8402  19 tcp4   *:445                 *:*
root     smbd       8402  20 tcp4   *:139                 *:*
root     nmbd       8396  7  udp4   *:137                 *:*
root     nmbd       8396  8  udp4   *:138                 *:*
root     nmbd       8396  9  udp4   192.168.15.120:137    *:*
root     nmbd       8396  10 udp4   192.168.15.120:138    *:*
lee      sshd       8295  3  tcp4   192.168.15.120:443    192.168.15.100:51367
root     sshd       8292  3  tcp4   192.168.15.120:443    192.168.15.100:51367
www      httpd      1808  3  tcp46  *:80                  *:*
www      httpd      1808  4  tcp4   *:*                   *:*
www      httpd      846   3  tcp46  *:80                  *:*
www      httpd      846   4  tcp4   *:*                   *:*
www      httpd      845   3  tcp46  *:80                  *:*
www      httpd      845   4  tcp4   *:*                   *:*
www      httpd      844   3  tcp46  *:80                  *:*
www      httpd      844   4  tcp4   *:*                   *:*
www      httpd      843   3  tcp46  *:80                  *:*
www      httpd      843   4  tcp4   *:*                   *:*
www      httpd      842   3  tcp46  *:80                  *:*
www      httpd      842   4  tcp4   *:*                   *:*
root     sshd       784   4  tcp4   *:443                 *:*
root     httpd      772   3  tcp46  *:80                  *:*
root     httpd      772   4  tcp4   *:*                   *:*
root     ntpd       749   4  udp4   *:123                 *:*
root     ntpd       749   6  udp4   192.168.15.120:123    *:*
root     ntpd       749   9  udp4   127.0.0.1:123         *:*
```

5. as root you can set passwords for the users who will be using Samba with: # smbpasswd user. They have to use their user (possibly WORKGROUP\user) and that password when prompted after trying to map a network drive on their Windows machine.


```
# smbpasswd jsmith
New SMB password:
Retype new SMB password:
```

Hopefully everything works now.


----------



## JGUK (Mar 8, 2009)

*Updatene step forward two steps back*

Hello everyone and thank you for all your responses!

Here's an update:

1) I CAN PING THE SERVER!!!!!  So for people having the same problems as me I will s-p-e-l-l it out 'cause I needed the same thing;

I think I could not ping the server because I had tried to start addition netbios processes in inetd.conf.  As SirDice says try not to use inetd.conf in FreeBSD versions 6.x or above as this is a legacy file and good sysadmin should move away from it.  

If you can ssh and ping from a windows computer on the same network, then your FreeBSD machine is most likely configured properly and your can look for configuration problems in the specific applications/services like Samba. 

2) All settings in inetd.conf are turned off except swat because I do not know how to set the configuration anywhere else. Is there a different config file that I can use to get swat to work instead of inetd.conf?

3) I was able to connect to smb via a ssh xterm from a remote computer using password = server but;

4) The same remote computer as above cannot see the server on network neighborhood, and I cannot connect to it.

5) nmbd is not running even if I try to start it from the swat page

Heres my printout from sockstat showing no nmbd like Ico's:

$ sockstat -4
USER     COMMAND    PID   FD PROTO  LOCAL ADDRESS         FOREIGN ADDRESS      
root     xterm      941   3  tcp4   127.0.0.1:50249       127.0.0.1:6011
jguksshd       937   3  tcp4   10.0.0.xxx:22         10.0.0.xxx:2532
jguksshd       937   8  tcp4   127.0.0.1:6011        *:*
jguksshd       937   9  tcp4   127.0.0.1:6011        127.0.0.1:50249
root     sshd       934   3  tcp4   10.0.0.xxx:22         10.0.0.xxx:2532
jgukopera      885   3  tcp4   127.0.0.1:64283       127.0.0.1:6010
root     xterm      879   3  tcp4   127.0.0.1:55355       127.0.0.1:6010
jguksshd       875   3  tcp4   10.0.0.xxx:22         10.0.0.xxx:2454
jguksshd       875   8  tcp4   127.0.0.1:6010        *:*
jguksshd       875   9  tcp4   127.0.0.1:6010        127.0.0.1:55355
jguksshd       875   11 tcp4   127.0.0.1:6010        127.0.0.1:64283
root     sshd       872   3  tcp4   10.0.0.xxx:22         10.0.0.xxx:2454
root     inetd      837   5  tcp4   *:901                 *:*
root     sshd       791   4  tcp4   *:22                  *:*
root     sendmail   750   3  tcp4   127.0.0.1:25          *:*
root     smbd       677   19 tcp4   *:445                 *:*
root     smbd       677   20 tcp4   *:139                 *:*
root     syslogd    598   7  udp4   *:514                 *:*


So since I think my problem in no longer a network or server problem I think my problem is only a SAMBA configuration problem.

If no one agrees with my above conclusion PLEASE RESPOND.

If there is no response to the contrary I will close this thread |(on a new message) and move my issue/review the SAMBA configuration help thread.


----------



## JGUK (Mar 31, 2009)

*I am concluding this thread ... problem solved*

To all thank you for your help.  I have concluded that my problems are solely with SAMBA so I am closing this thread.  I have taken the suggestions from above WRT setting up FreeBSD and it is very, very, stable.

So thank you all again for your help.

Now on to the SAMBA thread......


TTFN!


----------

