Samba Configuration
FreeBSD Installation
Install the Samba Port:
cd /usr/ports/net/samba
make install
To use the inetd daemon to start the Samba server:
In /etc/inetd.conf, uncomment:
netbios-ssn stream tcp nowait root /usr/local/sbin/smbd smbd
netbios-ns dgram udp wait root /usr/local/sbin/nmbd nmbd
restart inetd:
killall -1 inetd
To make Samba start at boot and run as a daemon:
/usr/local/etc/rc.d:
echo " smbd" && /usr/local/sbin/smbd -D
echo " nmbd" && /usr/local/sbin/nmbd -D
The Samba installation does not automatically create a configuration file.
You will need to copy a sample configuration file to the proper directory
and then edit it according to your own specifications:
cd /usr/ports/net/samba/work/samba-1.9.18p0/examples/simple
cp smb.conf /usr/local/etc
Linux Installation
RedHat:
rpm -i samba.version.rpm
# run 'setup' and configure daemon to start on boot.
Other:
tar -zxvf samba.version.tar.gz
make configure
make install
Samba will automatically install the startup script in the '/etc/rc.d/init.d'
System V directory.
Windows 9x/NT Usage
Windows 9x will need to know how to locate the server if it does not log
on automatically with the "Client for Microsoft Networks", domain logon
option. To setup the NetBios name resolution, you will need to either edit
or both create and edit the file named 'LMHOSTS' in the \WINDOWS
directory. This file is used for NetBios name resolution. The format is
described in the file \WINDOWS\LMHOSTS.SAM.
- Start Explorer or File Manager.
- Select "Map Network Drive".
- Select the drive you wish to map to.
- Enter \\SERVERNAME\FOLDERNAME in the Path field
In the above, the \\SERVERNAME is the NetBios name of the server running
Samba. The NetBios name of the server should be configured properly for
that machine in the "\WINDOWS\LMHOSTS" file. The FOLDERNAME entry is the
folder which you wish to map the drive to. These folders are configured in
the smb.conf file in blocks begining with the folder name, such as:
[FOLDERNAME]
comment = FOLDERNAME Folder
path = /path/to/FOLDERNAME
public = yes
writeable = no
printable = no
; valid users = spc
; remove valid users = xxx
; public = yes
; write list = @staff @wheel
; create mask = 0765
Samba Utilities
- testparms - Tests to see if ownership and permissions are set correctly for Samba-related files.
- testprns - Tests if a printer name is valid for Samba usage.
- smbstatus - Shows current connections to your Samba server.
- smbclient -L hostname - Shows available services on a Windows system acting as a server.
To test the connection:
% smbclient \\\\HOSTNAME\\RESOURCE
Added interface ip=10.0.0.1 bcast=10.0.0.255 nmask=255.255.255.0
Server time is Sun Oct 18 18:52:19 1998
Timezone is UTC+13.0
Password:
Domain=[WORKGROUP] OS=[Unix] Server=[Samba 1.9.18p8]
security=share
smb: \>
Samba Web Administration Tool (swat)
SWAT allows a Samba administrator to configure the complex smb.conf file
via a Web browser. In addition, a swat configuration page has help links to
all the configurable options in the smb.conf file allowing an administrator
to easily look up the effects of any change.
I recommend using SWAT to learn the syntax of the smb.conf file. It makes
configuration easy and gets Samba up and going quickly. Once you have your
Samba server configured, study the syntax of the smb.conf file to become
more proficient with writing your own by hand.
You need to edit your /etc/inetd.conf and /etc/services to enable SWAT to
be launched via inetd.
In /etc/services you need to add a line like this:
swat 901/tcp
The choice of port number isn't really important except that it should be
less than 1024 and not currently used (using a number above 1024 presents
an obscure security hole depending on the implementation details of your
inetd daemon).
In /etc/inetd.conf you should add a line like this:
swat stream tcp nowait.400 root /usr/local/samba/bin/swat swat
*or*
swat stream tcp nowait.400 root /usr/local/sbin/swat swat
Once you have edited /etc/services and /etc/inetd.conf you need to send a
HUP signal to inetd. To do this use "kill -1 PID" where PID is the process
ID of the inetd daemon.
Swat will rewrite your smb.conf file. It will rearrange the entries and
delete all comments, "include=" and "copy=" options. If you have a carefully
crafted smb.conf then back it up or don't use swat.
To access SWAT from a web browser, use the following URL syntax:
http://diamond.linux.lan:901/
http://192.168.1.1:901/
Where 192.168.1.1 is the address of the machine running Samba and 901 is
the port you specified in the "/etc/services" file.
Samba Links: