# [solved] Samba not listening

## s3ntient

I'm trying to get Samba directory and printer sharing working however no matter what I do iget the following error whenever I try to see my shares:

```
enoch samba # smbclient -L enoch

Error connecting to 127.0.0.1 (Connection refused)

Connection to enoch failed (Error NT_STATUS_CONNECTION_REFUSED)

```

Trying to isolate the problem, I reduced my smb.conf to the bare minimum:

```
[tmp]

comment = temporary files

path = /tmp

read only = yes

[globals]

hosts allow = 192.168.0.1/24 127.0.0.1

interfaces = eth0 eth1 lo

workgroup = WORKGROUP

netbios name = ENOCH

```

But I'm still getting the same error and netstat doesn't show samba listening on any port:

```
enoch samba # netstat -a

Active Internet connections (servers and established)

Proto Recv-Q Send-Q Local Address           Foreign Address         State

tcp        0      0 enoch.chaostrophy:mysql *:*                     LISTEN

tcp        0      0 *:svn                   *:*                     LISTEN

tcp        0      0 *:19150                 *:*                     LISTEN

tcp        0      0 *:http                  *:*                     LISTEN

tcp        0      0 *:39538                 *:*                     LISTEN

tcp        0      0 *:ipp                   *:*                     LISTEN

tcp        0      0 *:2200                  *:*                     LISTEN

tcp        0      0 *:smtp                  *:*                     LISTEN

tcp        0      0 enoch.chaostrophy.:2207 *:*                     LISTEN

udp        0      0 enoch.chaostrophy:27960 *:*

udp        0      0 *:ipp                   *:*
```

Any help in resolving this issue would be appreciated.

----------

## alex.blackbit

did samba start correctly? i mean both smbd and nmbd.

----------

## s3ntient

Hmm, /etc/init.d/samba start doesn't give me any errors however samba doesn't show up when I do ps -aux   :Confused: 

Edit:  if I start nmbd and smbd manually everything works, but the startup script in /etc/init.d doesn't seem to do anything

----------

## alex.blackbit

so, do i get that right...

```
/usr/sbin/smbd & /usr/sbin/nmbd &
```

results in running daemons,

```
/etc/init.d/samba start
```

does not?

----------

## s3ntient

Yeah, seems that my problem is in the /etc/init.d/samba script, but I can't figure out why   :Confused: 

/etc/conf.d/samba

```
add "winbind" to the daemon_list if you also want winbind to start

daemon_list="smbd nmbd"

#----------------------------------------------------------------------------

# Daemons calls: <daemon_name>_<command_option>

#----------------------------------------------------------------------------

my_service_name="samba"

my_service_PRE="unset TMP TMPDIR"

my_service_POST=""

#----------------------------------------------------------------------------

# Daemons calls: <daemon_name>_<command_option>

#----------------------------------------------------------------------------

smbd_start_options="-D"

smbd_start="start-stop-daemon --start --quiet --exec /usr/sbin/smbd -- ${smbd_start_options}"

smbd_stop="start-stop-daemon --stop --quiet --pidfile /var/run/samba/smbd.pid"

smbd_reload="killall -HUP smbd"

nmbd_start_options="-D"

nmbd_start="start-stop-daemon --start --quiet --exec /usr/sbin/nmbd -- ${nmbd_start_options}"

nmbd_stop="start-stop-daemon --stop --quiet --pidfile /var/run/samba/nmbd.pid"

nmbd_reload="killall -HUP nmbd"

winbind_start_options=""

winbind_start="start-stop-daemon --start --quiet --exec /usr/sbin/winbindd -- ${winbind_start_options}"

winbind_stop="start-stop-daemon --stop --quiet --oknodo --exec /usr/sbin/winbindd"

winbind_reload="killall -HUP winbindd"

```

/etc/init.d/samba

```
#!/sbin/runscript

# Copyright 1999-2007 Gentoo Foundation

# Distributed under the terms of the GNU General Public License, v2 or later

# $Header: /var/cvsroot/gentoo-x86/net-fs/samba/files/samba-init,v 1.15 2007/09/07 21:07:39 dev-zero Exp $

opts="reload"

depend() {

        after slapd

        need net

        use cupsd

}

DAEMONNAME="${SVCNAME##samba.}"

if [[ -n ${DAEMONNAME} ]] ; then

        daemon_list=${DAEMONNAME}

fi

signal_do() {

        local signal="$1"

        [ -z "${signal}" ] && return 0

        local result=0 last_result=0 daemon= cmd_exec=

        for daemon in ${daemon_list} ; do

                eval cmd_exec=\$${daemon}_${signal}

                if [ -n "${cmd_exec}" ]; then

                        ebegin "${my_service_name} -> ${signal}: ${daemon}"

                        #echo ${cmd} '->' ${!cmd}

                        ${cmd_exec} > /dev/null

                        last_result=$?

                        eend ${last_result}

                fi

                result=$(( ${result} + ${last_result} ))

        done

        return ${result}

}

start() {

        ${my_service_PRE}

        signal_do start && return 0

        eerror "Error: starting services (see system logs)"

        signal_do stop

        return 1

}

stop() {

        ${my_service_PRE}

        if signal_do stop ; then

            ${my_service_POST}

            return 0

        fi

}

reload() {

        ${my_service_PRE}

        signal_do reload

}

```

----------

## alex.blackbit

my versions differs, naturally, it is version 1.17, you have 1.15.

my samba installation is 3.0.28, which is the only stable version in portage currently.

which version are you running?

try to update, maybe that helps.

----------

## s3ntient

That's weird because I had just emerged samba and it didn't give me the option to update that script via etc-update.

Anyway, I updated it and now everything works!

Thanks for your help   :Very Happy: 

----------

