-->
Previous | Table of Contents | Next |
The following example shows a sample output from running testparm. If the smb.conf file contains any errors, the program will report them along with a specific error message.
# testparm Load smb config files from /etc/smb.conf Processing section [homes] Processing section [printers] Loaded services file OK. Press enter to see a dump of your service definitions
When you press the <Enter> key, testparm will begin evaluating each section defined in the configuration file.
The Samba server consists of two daemons, smbd and nmbd. The smbd daemon provides the file and print sharing services. The nmbd daemon provides NetBIOS name server support.
You can run the Samba server either from the init scripts as detailed in Chapter 9 or from inetd as a system service.
See Understanding the Boot Process, p. 206
Because Red Hat and Caldera both start SMB services from the init scripts instead of as a service from inetd, you can use the following command to start or stop the SMB server:
/etc/rc.d/init.d/samba start|stop
The smbclient program allows Linux users to access SMB shares on other, typically Windows, machines. This is because if you want to access files on other Linux boxes, you can use a variety of methods including FTP, NFS, and the r- commands (like rcp ).
See Using the r- Commands, p. 589
smbclient provides an FTP-like interface that allows you to transfer files with a network share on another computer running an SMB server. Unfortunately, unlike NFS, smbclient does not allow you to mount another share as a local directory.
smbclient provides command line options to query a server for the shared directories available or to exchange files. For more information on the available command line options, consult the man page for smbclient. Use the following command to list all available shares on the machine win.netwharf.com:
smbclient -L -I win.netwharf.com
The -L parameter requests the list. The -I parameter instructs smbclient to treat the following machine name as a DNS specified entry instead of a NetBIOS entry.
To transfer a file, you must first connect to the Samba server by using the following command:
smbclient \\WORKGROUP\PUBLIC -I win.netwharf.com -U tackett
The parameter \\WORKGROUP\PUBLIC specifies the remote service on the other machine. This is typically either a file system directory or a printer. The -U option allows you to specify the username with which you want to connect. Samba will prompt you for a password (if this account requires one) and then place you at this prompt
smb: \
where \ indicates the current working directory.
From this command line, you can issue any of the various commands shown in Table 15.1 to transfer and work with files.
Command | Parameters | Description |
---|---|---|
? or help | [command] | Provides a help message on command, or in general if no command is specified. |
! | [shell command] | Executes the specified shell command or drops the user to a shell prompt. |
cd | [directory] | Changes to the specified directory on the server machine (not the local machine). If no directory is specified, smbclient will report the current working directory. |
lcd | [directory] | Changes to the specified directory on the local machine. If no directory is specified, smbclient will report the current working directory on the local machine. |
Del | [files] | The specified files on the server will be deleted if the user has permission to do so. Files can include wildcard characters. |
dir or ls | [files] | Lists the indicated files. You can also use the command ls to get a list of files. |
exit or quit | none | Exits from the smbclient program. |
get | [remote file] [local name] | Retrieves the specified remote file and saves the file on the local server. If local name is specified, the copied file will be saved with this filename instead of with the filename on the remote server. |
mget | [files] | Copies all the indicated filesincluding those matching any wildcardsto the local machine. |
md or mkdir | [directory] | Creates the specified directory on the remote machine. |
rd or rmdir | [directory] | Removes the specified directory from the remote machine. |
put | [file] | Copies the specified file from the local machine to the server. |
mput | [files] | Copies all the specified files from the local machine to the server. |
[file] | Prints the specified file on the remote machine. | |
queue | none | Displays all the print jobs queued on the remote server. |
You can read the following chapters for further information about Linux as related to using Samba:
Previous | Table of Contents | Next |