June 17, 2018

Linux Networking: Exploring Samba - page 4

The Samba Essentials

  • July 10, 2000
  • By William Wong

The smbclient program operates like the ftp program. The difference is the former uses a Samba-compatible server while the latter uses an ftp server. Operationally the two client applications are very similar. Both make a connection, allow files to be exchanged, and then terminate. No directories are mounted as with smbfs, so local applications can only use remote files once they are copied. Likewise, changes are only made to the local copy.

As with the ftp program, the smbclient program operates in command line mode or interactive mode. The former uses command line arguments to specify the share to use and the files to transfer. The latter prompts for commands and executes them until an exit command is encountered. A file with commands can also be executed.

The smbclient requires at least a UNC for the share to be accessed. Arguments include attributes like user name and password. These may not be required depending upon the security method used by the share. If the -c option is used then it is followed by the command to be executed, otherwise the interactive mode is entered. The following prompt is then presented:

     smb\ >

Familiar ftp commands like ls, cd, get, put, mget and mput can be used. There is no distinction between text and binary transfers. With smbclient, all transfers are binary.

The choice between using smbfs and smbclient is usually simple. Use smbfs when other programs will be used to access remote files. Use smbclient if files need to be moved from one computer to another. It is faster to use smbclient for this type of transfer than using smbmount, cp followed by umount.

Samba Printer Support
Samba print server support is part of the Samba server, smbd. The Samba print client is implemented using smbprint, a utility installed with Samba.

The linuxconf program does not do as well with printer share configuration as with disk share configuration, although this is improving with each new release of linuxconf. Editing the smb.conf file may be necessary if multiple printers are to be shared using different settings. In general, linuxconf can allow access to all or none.

The printer configuration is found in the [printers] group in the smb.conf file. Check out the online help via man smb.conf for more details. Make sure the printer to be shared is already set up before making changes to smb.conf.

Configuration under Red Hat for the smbprint program is easier. It uses the linuxconf program; a screen for accessing a Samba-compatible printer is shown in Figure 4. This does two things. First it creates an entry in /etc/printcap. Second, it creates a directory in the /var/spool/lpd directory with the name of the printer. This is true even for local printers. In this printer directory, the file .config is created. For the sample shown in the figure, the contents of the .config file are:


Having a password in this file can be a problem in some environments. The lines added to the /etc/printcap file are:


Note the smbprint program listed in the last line.

Most Popular LinuxPlanet Stories

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.