Nethence Newdoc Olddoc Lab Your IP BBDock  

Warning: those guides are mostly obsolete, please have a look at the new documentation.


Basic Samba configuration
On Redhat systems,
rpm -q samba
service samba restart
chkconfig samba on
On NetBSD,
#export PKG_PATH=
pkg_add samba
cd /etc/rc.d/
cp /usr/pkg/share/examples/rc.d/winbindd .
cp /usr/pkg/share/examples/rc.d/smbd .
cp /usr/pkg/share/examples/rc.d/samba .
cp /usr/pkg/share/examples/rc.d/nmbd .
cd ../
cat >> rc.conf <<EOF9
rc.d/samba restart
On NetBSD only,
cd /etc/
ln -s /usr/pkg/etc/samba
Then on any system,
cd /etc/samba/
mv smb.conf smb.conf.dist
sed '/^[[:space:]]*$/d; /^[[:space:]]*;/d; /^[[:space:]]*#/d;' smb.conf.dist > smb.conf
vi smb.conf
workgroup = ... 
printing = bsd
unix extensions = no
Note. printing = bsd to avoid this recurrent error (also touch /etc/printcap). "printcap name = /etc/printcap" is supposed to works too.
Unable to connect to CUPS server localhost:631 - Connection refused
Note. unix extensions no to disable symlinks and such.
If you don't want to share home directories but precise folder locations,
path = /data
valid users = USERNAME 
writable = yes
printable = no
Fix the ulimit system-wide. On Redhat,
vi /etc/security/limits.conf
* - nofile 16384
samba soft nofile 16384
samba hard nofile 32768
on NetBSD,
echo "kern.maxfiles=30000" >> /etc/sysctl.conf
sysctl -w kern.maxfiles=30000
vi /etc/login.conf
:path=/usr/bin /bin /usr/sbin /sbin /usr/X11R6/bin /usr/pkg/bin /usr/pkg/sbi
n /usr/local/bin:\
cap_mkdb /etc/login.conf
##usermod -L default root
#echo 'start_precmd="ulimit -n 16384"' > /etc/rc.conf.d/samba
Now enter a new shell to run the new file descriptor limit and check the configuration,
ulimit -n
(netbsd) sysctl kern.maxfiles
(netbsd) sysctl proc.curproc.rlimit.descriptors
Restart the daemon to apply the changes. On Redhat systems,
service samba restart
on NetBSD,
/etc/rc.d/samba restart
Add the samba user and check (same UNIX user needs to exist, or edit smbusers),
cd /etc/samba/
cat smbpasswd
smbpasswd -a USERNAME 
ls -l private/
The log file location:
- on Redhat it is /var/log/samba/log.%m
- on Slackware it is /var/log/samba.%m
- on NetBSD it is
Guest account
If you want the 'guest' account to work, create the guest user,
useradd guest
smbpasswd -a guest
note. you can also use /etc/samba/smbusers to link the samba guest user with system's nobody user.
and configure the shared folder,
cd /etc/samba/
vi smb.conf
guest account = guest
unix extensions = no
path = /data/nas
#valid users = username
public = yes
writable = yes
printable = no
note. 'public' is a synonym for 'guest ok'
Additionnal settings
Note. for some embedded system you may prefer not to have any logs,
;log level = 0
Note. to secure the thing a little bit,
;hosts allow = 10.1.1
Note. to force rights, e.g. enabling group to write,
  ;create mask = 0770
;directory mask = 0770
Client usage
Check the share is available,
smbclient -W workgroup_or_domaine -U username -L SAMBA_SRV
Mount the share,
mount.cifs //samba_srv/share_name /mnt/smb -o rw,user=username,pass=password,dom=workgroup_or_domain
Note. on some systems it's mount.smbfs or smbmount instead of mount.cifs.
Note. eventually add password="PASSWORD"
Enable at system's startup,
cd /etc/
vi fstab
//samba_srv/share_name /mnt/mount_point cifs rw,credentials=/etc/smb.client 0 0
configure the credentials,
cd /etc/
vi smb.client
fix the permissions,
chmod 600 smb.client
Note. smbd ports,
135 tcp
139 tcp
445 tcp
Note. nmbd ports,
137 udp
138 udp
If you get this error while doing 'textparm',
rlimit_max: rlimit_max (3404) below minimum Windows limit (16384)
then you should increase the max opened file descriptor limit. See above.
Chapter 19. Tuning NetBSD:
tuning netbsd for performance:
Resolving samba testparm message: rlimit_max: rlimit_max (8192) below minimum Windows limit (16384):

(obsolete, see the new doc)