Now that your smb.conf
file is correctly configured, you can start your Samba server daemon. You can do so with the /usr/sbin/smbd
command, which (with no options) starts the Samba server with all the defaults. The most common option you will change in this command is the location of the smb.conf
file; you change this option if you don't want to use the default location /etc/smb/smb.conf
. The -s option allows you to change the smb.conf
file Samba uses; this option is also useful for testing whether a new smb.conf
file actually works. Another useful option is the -l option, which specifies the log file Samba uses to store information.
To start, stop, or restart Samba from the command line, use the service
command, the system-config-services
client, or the /etc/rc.d/init.d/smb
script with a proper keyword, such as start
, like so:
# /etc/rc.d/init.d/smb start
smbstatus
CommandThe smbstatus
command reports on the current status of your Samba connections. The syntax is as follows:
/usr/bin/smbstatus [
Table 19.2 shows some of the available options.
TABLE 19.2 smbstatus
Options
Option | Result |
---|---|
-b | Brief output. |
-d | Verbose output. |
-s | Used if the configuration file used at startup is not the standard one. |
-u | Shows the status of a specific user's connection. |
-p | Lists current smb processes. This can be useful in scripts. |
smbclient
CommandThe smbclient
command allows users on other Linux hosts to access your smb
shares. You cannot mount the share on your host, but you can use it in a way that is similar to that you'd use with an FTP client. Several options can be used with the smbclient
command.
The most frequently used is -I
, followed by the IP address of the computer to which you are connecting. The smbclient
command does not require root access to run:
smbclient -I 10.10.10.20 -U username%password
This gives you the following prompt:
smb: <current directory on share>
From here, the commands are almost identical to the standard UNIX/Linux FTP commands. Note that you can omit a password on the smbclient command line. You are then prompted to enter the Samba share password.
Mounting Samba Shares
There are two ways to mount Samba shares to your Linux host. Mounting a share is the same as mounting an available media partition or remote NFS directory, except that you use SMB to access the Samba share. (See Chapter 35, 'Managing the File System,' to see how to mount partitions.) The first method uses the standard Linux mount
command:
mount -t smbfs //10.10.10.20/homes /mount/point -o username=ahudson,dmask=777,
fmask=777
/etc/hosts
file.This command mounts ahudson
's home directory on your host and gives all users full permissions to the mount. The permissions are equal to the permissions on the chmod
command.
The second method produces the same results, using the smbmount
command as follows:
# smbmount //10.10.10.20/homes /mount/point -o username=ahudson,dmask-777,
fmask=777
To unmount the share, use the standard:
# umount /mount/point
These mount
commands can also be used to mount true Windows client shares to your Fedora host. Using Samba, you can configure your server to provide any service Windows can serve, and no one but you will ever know.
Network and Remote Printing with Fedora
Chapter 8, 'Printing with Fedora,' discussed how to set up and configure local printers and the associated print services. This section covers configuring printers for sharing and access across a network.
Offices all over the world benefit from using print servers and shared printers. In my office, I have two printers connected to the network via a Mac mini with Fedora PPC so that my wife can print from downstairs