The key to configuring Samba is its lone configuration file:
smb.conf. This configuration file can be very simple or extremely complex, and the rest of this book is devoted to helping you get deeply personal with this file. For now, however, we'll show you how to set up a single file service, which will allow you to fire up the Samba daemons and see that everything is running as it should be. In later chapters, you will see how to configure Samba for more complicated and interesting tasks.
The installation process does not automatically create an
smb.conf configuration file, although several example files are included in the Samba distribution. To test the server software, though, we'll use the following file. It should be named
smb.conf and placed in the
/usr/local/samba/lib directory.[]
[global]
workgroup = SIMPLE
[test]
comment = For testing only, please
path = /export/samba/test
read only = no
guest ok = yes
This brief configuration file tells the Samba server to offer the directory
/export/samba/test on the server as an SMB/CIFS share called test
. The server also becomes part of the named workgroup SIMPLE, which each of the clients must also be a part of. (Use your own workgroup here if you already know what it is.) We'll use the
[test]
share in the next chapter to set up the Windows clients. For now, you can complete the setup by performing the following commands as root on your Unix server:
#
mkdir /export/samba/test
#
chmod 777 /export/samba/test
We should point out that in terms of system security, this is the worst setup possible. For the moment, however, we only wish to test Samba, so we'll leave security out of the picture. In addition, there are some encrypted password issues that we will encounter with Windows clients later on, so this setup will afford us the least amount of headaches.
If you are using Windows 98 or Windows NT Service Pack 3 or above, you must add the following entry to the
[global]
section of the Samba configuration file:
encrypt passwords = yes
. In addition, you must use the
smbpassword program (typically located in
/usr/local/samba/bin/ ) to reenter the username/password combinations of those users on the Unix server who should be able to access shares into Samba's encrypted client database. For example, if you wanted to allow Unix user
steve
to access shares from an SMB client, you could type:
smbpassword -a steve
. The first time a user is added, the program will output an error saying that the encrypted password database does not exist. Don't worry, it will then create the database for you. Make sure that the username/password combinations that you add to the encrypted database match the usernames and passwords that you intend to use on the Windows client side.