Chapter 5. Samba and NFS

Table of Contents

5.1. Samba Client Tools
5.1.1. nmblookup
5.1.2. smbpasswd
5.1.3. smbtar
5.1.4. smbclient
5.1.5. smbstatus
5.2. Configuring a SAMBA server
5.2.1. The Configuratiion Files
5.2.2. The smb.conf Sections
5.2.3. Main Options in [share] Sections
5.3. Examples
5.3.1. Shared Directories
5.3.2. Sharing Printers
5.3.3. Implementing WINS with Samba?
5.3.4. Samba server as a Domain Controller
5.4. Configuring an NFS server
5.4.1. The /etc/exports file
5.4.2. User Mappings
5.4.3. Anonuid and Anongid
5.4.4. Root Squashing
5.4.5. TCPwrappers
5.4.6. Using exportfs and nfsstat
5.5. Setting up an NFS Client

This module covers SAMBA and NFS. The objectives state a few specific implementations such as file servers and printer shares.

5.1. Samba Client Tools

5.1.1. nmblookup

In the most simple cases, the nmblookup command will associate an IP to a NetBIOS hostname by querying the broadcast.

nmblookup trainer-1
querying trainer-1 on 192.168.3.255
192.168.3.101 trainer-1<00>

One can also specify which broadcast to query with the -M option:

nmblookup trainer-1 -B 192.168.123.255
querying trainer-1 on 192.168.123.255
192.168.123.107 trainer-1<00>
192.168.3.1 trainer-1<00>

Another usage is to query a WINS server directly. If the WINS server is called winserv and the hostname is again trainer-1 the command has the following syntax:

nmblookup -U winserv -R trainer-1
querying trainer-1 on 192.168.123.1
192.168.123.113 trainer-1<00>

5.1.2. smbpasswd

The smbpasswd command is used to add users to the samba database (the smbpasswd file by default). Then it is also used to modify existing samba passwords.

[Note]Note

Only existing UNIX accounts can be added to the samba database

smbpasswd -a USERadd a samba user
smbpasswd -e USERenable a samba user
smbpasswd -d USERdisable a samba user

5.1.3. smbtar

Script using smbclient to archive SMB shares directly to tape

5.1.4. smbclient

smbclient //HOST/SHARELogs onto the specified share
smbpasswd -L //HOSTList all available shares

5.1.5. smbstatus

Output of smbstatus

Samba version 2.2.7a-security-rollup-fix
Service  uid    gid     pid  machine
----------------------------------------------
dean     dean   dean    3106 trainer-1 (192.168.3.101) Mon Nov 26 13:34:54 2003
IPC$     nobody nogroup 3106 trainer-1 (192.168.3.101) Mon Nov 26 13:34:45 2003
IPC$     nobody nogroup 3106 trainer-1 (192.168.3.101) Mon Nov 26 13:34:53 2003
dean     dean   dean    3106 trainer-1 (192.168.3.101) Mon Nov 26 13:35:14 2003
netlogon dean   dean    3106 trainer-1 (192.168.3.101) Mon Nov 26 13:34:54 2003
public   nobody nogroup 3145 drakelap (192.168.3.100) Mon Nov 26 13:35:34 2003
IPC$     nobody nogroup 3106 trainer-1 (192.168.3.101) Mon Nov 26 13:34:54 2003