Путаюсь настроить SAMBA на 2 разных интерфейса с разными smb.conf.
Самба из репы, собрана со следующими параметрами путями:
Код: Выделить всё
avr ~ # smbd -b | grep /
Build host: Linux biber 2.6.32-5-amd64 #1 SMP Thu Mar 22 17:26:33 UTC 2012 i686 GNU/Linux
SRCDIR: /build/buildd-samba_3.5.6~dfsg-3squeeze7-i386-oNRyFO/samba-3.5.6~dfsg/source3
BUILDDIR: /build/buildd-samba_3.5.6~dfsg-3squeeze7-i386-oNRyFO/samba-3.5.6~dfsg/source3
SBINDIR: /usr/sbin
BINDIR: /usr/bin
SWATDIR: /usr/share/samba/swat
CONFIGFILE: /etc/samba/smb.conf
LOGFILEBASE: /var/log/samba
LMHOSTSFILE: /etc/samba/lmhosts
LIBDIR: /usr/lib/samba
MODULESDIR: /usr/lib/samba
LOCKDIR: /var/run/samba
STATEDIR: /var/lib/samba
CACHEDIR: /var/cache/samba
PIDDIR: /var/run/samba
SMB_PASSWD_FILE: /etc/samba/smbpasswd
PRIVATE_DIR: /etc/sambasmb-avr.conf содержит вот такую инфу:
Код: Выделить всё
avr ~ # testparm -s /etc/samba/smb-avr.conf
Load smb config files from /etc/samba/smb-avr.conf.comment
rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)
Processing section "[backup$]"
Processing section "[windows$]"
Processing section "[video$]"
Processing section "[Мусорка продажников]"
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_DOMAIN_MEMBER
[global]
workgroup = DOMAIN
realm = DOMAIN.LOCAL
server string = cсервер
interfaces = eth1
bind interfaces only = Yes
security = ADS
auth methods = winbind
password server = server.domain.local
username map = /etc/samba/userssmb
log level = 4
log file = /var/log/samba-avr/log.%m
smb ports = 139
socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
load printers = No
disable spoolss = Yes
show add printer wizard = No
lock directory = /var/run/samba-avr
state directory = /var/lib/samba-avr
cache directory = /var/cache/samba-avr
pid directory = /var/run/samba-avr
usershare path =
idmap uid = 10000-20000
idmap gid = 10000-20000
winbind separator = ^
winbind cache time = 600
winbind enum users = Yes
winbind enum groups = Yes
winbind use default domain = Yes
winbind refresh tickets = Yes
winbind offline logon = Yes
<...>init-скрипт модифицировал:
Код: Выделить всё
avr ~ # cat /etc/init.d/samba-avr
#!/bin/sh
### BEGIN INIT INFO
# Provides: samba-avr
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Should-Start: slapd
# Should-Stop: slapd
# Short-Description: start Samba AVR daemons (nmbd and smbd)
### END INIT INFO
# Defaults
RUN_MODE="daemons"
# Reads config file (will override defaults above)
[ -r /etc/default/samba-avr ] && . /etc/default/samba-avr
PIDDIR=/var/run/samba-avr
NMBDPID=$PIDDIR/nmbd.pid
SMBDPID=$PIDDIR/smbd.pid
CONF=/etc/samba/smb-avr.conf
# clear conflicting settings from the environment
unset TMPDIR
# See if the daemons are there
test -x /usr/sbin/nmbd -a -x /usr/sbin/smbd || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Samba daemons in DOMAIN DOMAIN.LOCAL and host AVR"
# Make sure we have our PIDDIR, even if it's on a tmpfs
install -o root -g root -m 755 -d $PIDDIR
NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' $CONF 2>/dev/null`
if [ "$NMBD_DISABLED" != 'Yes' ]; then
log_progress_msg "nmbd"
if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/nmbd -- -D $NMBDOPTIONS -s $CONF
then
log_end_msg 1
exit 1
fi
fi
if [ "$RUN_MODE" != "inetd" ]; then
log_progress_msg "smbd"
if ! start-stop-daemon --start --quiet --oknodo --exec /usr/sbin/smbd -- -D $SMBDOPTIONS -s $CONF ; then
log_end_msg 1
exit 1
fi
fi
log_end_msg 0
;;
stop)
log_daemon_msg "Stopping Samba daemons AVR"
log_progress_msg "nmbd"
start-stop-daemon --stop --quiet --pidfile $NMBDPID
# Wait a little and remove stale PID file
sleep 1
if [ -f $NMBDPID ] && ! ps h `cat $NMBDPID` > /dev/null
then
# Stale PID file (nmbd was succesfully stopped),
# remove it (should be removed by nmbd itself IMHO.)
rm -f $NMBDPID
fi
if [ "$RUN_MODE" != "inetd" ]; then
log_progress_msg "smbd"
start-stop-daemon --stop --quiet --pidfile $SMBDPID
# Wait a little and remove stale PID file
sleep 1
if [ -f $SMBDPID ] && ! ps h `cat $SMBDPID` > /dev/null
then
# Stale PID file (nmbd was succesfully stopped),
# remove it (should be removed by smbd itself IMHO.)
rm -f $SMBDPID
fi
fi
log_end_msg 0
;;
reload)
log_daemon_msg "Reloading /etc/samba/smb.conf" "smbd only on AVR"
start-stop-daemon --stop --signal HUP --pidfile $SMBDPID
log_end_msg 0
;;
restart|force-reload)
$0 stop
sleep 1
$0 start
;;
status)
status="0"
NMBD_DISABLED=`testparm -s --parameter-name='disable netbios' $CONF 2>/dev/null`
if [ "$NMBD_DISABLED" != "Yes" ]; then
status_of_proc -p $NMBDPID /usr/sbin/nmbd nmbd || status=$?
fi
if [ "$RUN_MODE" != "inetd" ]; then
status_of_proc -p $SMBDPID /usr/sbin/smbd smbd || status=$?
fi
if [ "$NMBD_DISABLED" = "Yes" -a "$RUN_MODE" = "inetd" ]; then
status="4"
fi
exit $status
;;
*)
echo "Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}"
exit 1
;;
esac
exit 0При этом, при запуске service samba-avr start, smbd не запускается с сообщением:
Код: Выделить всё
[2012/05/05 13:56:29.663057, 2] lib/util_tdb.c:521(tdb_wrap_log)
tdb(unnamed): tdb_open_ex: could not open file /var/lib/samba/secrets.tdb: Нет такого файла или каталога
[2012/05/05 13:56:29.663313, 3] lib/dbwrap_tdb.c:357(db_open_tdb)
Could not open tdb: Нет такого файла или каталога
[2012/05/05 13:56:29.663496, 0] passdb/secrets.c:73(secrets_init)
Failed to open /var/lib/samba/secrets.tdb
[2012/05/05 13:56:29.664169, 3] smbd/server.c:1165(main)
loaded services
[2012/05/05 13:56:29.664340, 3] smbd/server.c:1180(main)
Becoming a daemon.
[2012/05/05 13:56:29.667499, 2] lib/util_tdb.c:521(tdb_wrap_log)
tdb(unnamed): tdb_open_ex: could not open file /var/lib/samba/secrets.tdb: Нет такого файла или каталога
[2012/05/05 13:56:29.669931, 3] lib/dbwrap_tdb.c:357(db_open_tdb)
Could not open tdb: Нет такого файла или каталога
[2012/05/05 13:56:29.670839, 0] passdb/secrets.c:73(secrets_init)
Failed to open /var/lib/samba/secrets.tdb
[2012/05/05 13:56:29.671751, 0] smbd/server.c:1223(main)
ERROR: smbd can not open secrets.tdbВ итоге, я прихожу к выводу, что по какой-то причине smbd не принимает параметр state directory, который задает положение tdb файлов.
Отсюда вопрос - как ему указать этот параметр, чтобы брал не по умолчанию?