How to Start, Stop, and Restart Samba

Samba is a free software re-implementation of SMB/CIFS networking protocol, originally developed by Australian Andrew Tridgell. As of version 3, Samba provides file and print services for various Microsoft Windows clients and can integrate with a Windows Server domain, either as a Primary Domain Controller (PDC) or as a domain member. It can also be part of an Active Directory domain.
Most Linux distributions come with scripts to start, stop, and restart Samba properly. If yours does not, use the commands under the Optional Commands column 

 Runlevel ScriptOptional Command
Start Samba/etc/rc.d/init.d/samba start/usr/sbin/smbd -D and /usr/sbin/nmbd -D
Stop Samba/etc/rc.d/init.d/samba stopkillall -TERM smbd and killall -TERM nmbd
Restart Samba/etc/rc.d/init.d/samba restartkillall -HUP smbd and killall -HUP nmbd

Samba Log Files

    All Samba actions such as login attempts and file transfers can be logged in the /var/log/samba directory. Under this directory the actions are logged by machine name. For example, all actions from the machine named “Morpheus” are logged in the file /var/log/samba/log.morpheus. User actions can also be logged under two files named/var/log/log.smb and /var/log/log.nmb. This is configured in the smb.conf file using the option log file. For example, to log actions by machine name use the following line: 
log file = /var/log/samba/log.%m

Windows Workgroup

    You can specify which Windows Network Neighborhood Workgroup your Linux machine is seen in and the description of the machine by editing the following lines insmb.conf: 
workgroup = WORKGROUPNAME
server string = MACHINE DESCRIPTION

Access Control

    smb.conf can be used to allow and deny access by IP addresses. This is done by listing IP addresses or subnets on the lines beginning with hosts allow and hosts deny. Examples:

ExampleExplanation
hosts allow 192.168.10.0/255.255.255.0Allow all hosts in the given network/netmask
hosts allow 160.210 EXCEPT 160.210.24.56Allow all hosts beginning with 160.210 except 160.210.24.56
hosts allow 192.168.10 192.168.20allow all hosts beginning with 192.168.10 or 192.168.20
hosts deny 130.74deny all hosts beginning with 130.74



Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>