Monday, August 12, 2002

Samba Share

Download Samba

curl -L -O

To verify that the package hasn't been tampered with, you can use gpg:
$gunzip samba-3.x.x.tar.gz
$ curl -L -O
$ gpg --keyserver-options auto-key-retrieve --verify samba-3.x.x.tar.asc

You can then build and install Samba with:

$ tar xvf samba-3.x.x.tar
$ cd samba-3.x.x
$ cd source
$ ./configure
$ make
# make install
# cd /usr/bin ; ln -sf /usr/local/samba/bin/* .

You'll want to verify that your /etc/services file contains:

netbios-ns 137/udp # NETBIOS Name Service
netbios-dgm 138/udp # NETBIOS Datagram Service
netbios-ssn 139/tcp # NETBIOS Session Service

Verify that you've typed the syntax of your configuration file:

$ testparm
microsoft-ds 445/tcp # Microsoft-DS

# cd /usr/sbin ; ln -sf /usr/local/samba/sbin/* .

To launch Samba, run:
# smbd -D
# nmbd -D

Configuring Samba

Out of the box, Samba does not contain any configuration files whatsoever. It is up to you, the system administrator, to create this configuration file. By default, it is located in the /usr/local/samba/lib/smb.conf file. The other file you'll need to create is /usr/local/samba/private/smbpasswd. Ironically, its initial contents should be blank, but you can simply create both with:

# touch /usr/local/samba/lib/smb.conf
# touch /usr/local/samba/private/smbpasswd
# chmod 0644 /usr/local/samba/lib/smb.conf
# chmod 0600 /usr/local/samba/private/smbpasswd

So you want to just get things up and running, eh? In a nutshell, you could use something like:

encrypt passwords = yes
guest account = smbguest
netbios name = MYSERVER
security = share
wins support = yes
workgroup = WORKGROUP

path = /cifs/pub
read only = no
guest ok = yes
guest only = yes

Make the following changes to /etc/passwd (Hint: try "man 8 vipw"):


Make the following changes to /etc/shadow (Hint: try "vipw -s"):


Make the following changes to /etc/group (Hint: try "man 8 vigr"):


Run the following commands on your server. When prompted for a password for smbguest, just hit ENTER twice:

# mkdir -p /cifs/pub
# chmod 0777 /cifs/pub
# smbpasswd -a smbguest

You'll need to stop and restart the Samba server with something like:

# killall smbd nmbd
# smbd -D
# nmbd -D

If your Windows machine is on the same subnet as your Samba server, you should now be able to connect to the Samba server by clicking on Start / Run and typing: