Chapter 2. No Frills Samba Servers
Prev |  | Next

## Chapter 2. No Frills Samba Servers

Congratulations, you managed to get past the opening chapter. To some, this is where the interesting exercises begin. This is the start of the real journey toward the Samba deployment of a lifetime.

## Introduction

This chapter lays the groundwork for understanding the basics of Samba operation. Instead of a bland technical discussion, each principle is demonstrated by way of a real-world scenario for which a working solution[2] is fully described.

The practical exercises take you on a journey through a drafting office, a charity administration office, and an accounting office. You may choose to apply any or all of these to your own environment.

Every assignment case can be implemented far more creatively, but remember that the solutions you create are designed to demonstrate a particular solution possibility. With experience, you should find much improved solutions compared with those presented here. By the time you complete this book, you should aim to be a Samba expert, so do attempt to find better solutions and try them as you work your way through the examples.

## Assignment Tasks

Each case presented highlights different aspects of Windows networking for which a simple Samba-based solution can be provided. Each has subtly different requirements taken from real-world cases. Each is briefly reviewed to cover points of highlight. In each example, instructions are based on the assumption that the official Samba Team RPM package has been installed.

This chapter has three assignments built around ficticious companies:

- A drafting office

- A charity administration office

- An accounting office

Let's get started.

### Drafting Office

Our fictitious company is called Abmas Design Inc. This is a three-person computer-aided design (CAD) business that often has more work than can be handled. The business owner hires contract draftspeople from wherever he can. They bring their own notebook computers into the office. There are four permanent drafting machines. Abmas has a collection of over 10 years of plans that must be available for all draftsmen to reference. Abmas hires the services of an experienced network engineer to update the plans that are stored on a central server one day per month. She knows how to upload plans from each machine. The files available from the server must remain read-only. Anyone should be able to access the plans at any time and without barriers or difficulty.

Mr. Bob Jordan has asked you to install the new server as economically as possible. The central server has a Pentium-IV 1.6GHz CPU, 768MB RAM, a 20GB IDE boot drive, a 160GB IDE second disk to store plans, and a 100-base-T Ethernet card. You have already installed Red Hat Fedora Core2 and have upgraded Samba to version 3.0.12 using the RPM package that is provided from the Samba FTP sites.

The four permanent drafting machines (Microsoft Windows workstations) have attached printers and plotters that are shared on a peer-to-peer basis by any/all network users. The intent is to continue to share printers in this manner. The three permanent staff work together with all contractors to store all new work on one PC. A daily copy is made of the work storage area to another PC for safekeeping. When the network consultant arrives, the weekly work area is copied to the central server and the files are removed from the main weekly storage machine. The office works best with this arrangement and does not want to change anything. Old habits are too ingrained.

#### Dissection and Discussion

The requirements for this server installation demand simplicity. An anonymous read-only file server adequately meets all needs. The network consultant determines how to upload all files from the weekly storage area to the server. This installation should focus only on critical aspects of the installation.

It is not necessary to have specific users on the server. The site has a method for storing all design files (plans). Each plan is stored in a directory that is named YYYYWW[3], where YYYY is the year, and WW is the week of the year. This arrangement allows work to be stored by week of year to preserve the filing technique the site is familiar with. There is another customer directory that is alphabetically listed. At the top level are 26 directories (A-Z), in each is a second level of directory for the first plus second letter of the name (A-Z); inside each is a directory by the customers' name. Inside each directory is a symbolic link to each design drawing/plan. This way of storing customer data files permits all plans to be located both by customer name, as well as by the date the work was performed, without demanding the disk space that would be needed if a duplicate file copy were to be stored. The share containing the plans is called Plans.

#### Implementation

It is assumed that the server is fully installed and ready for installation and configuration of Samba 3.0.12 and any support files needed. All TCP/IP addresses have been hard coded. In our case the IP address of the Samba server is `192.168.1.1` and the netmask is `255.255.255.0`. The host name of the server used was `server`.

Procedure 2.1. Samba Server Configuration

1. Download the Samba-3 RPM packages for Red Hat Fedora Core2 from the Samba FTP servers.

2. Install the RPM package as using either the Red Hat Linux preferred GUI tool or using the rpm, as follows:

       root#  rpm -Uvh samba-3.0.12-1.i386.rpm

3. Create a mount point for the file system that will be used to store all data files. You can create a directory called `/plans` as follows:

       root#  mkdir /plans
       root#  chmod 755 /plans

   The 755 permissions on this directory (mount point) permit the owner to read, write and execute, and the group and everyone else to read and execute only.

   Use Red Hat Linux system tools (refer to Red Hat instructions for instructions) to format the 160GB hard drive with a suitable file system. An Ext3 file system is suitable. Configure this drive to automatically mount using the `/plans` directory as the mount point.

4. Install the `smb.conf` file shown in ??? in the `/etc/samba` directory.

   Example 2.1. Drafting Office smb.conf File

   # Global Parameters
   `[global]`
   `workgroup = MIDEARTH`
   `security = SHARE`
   `[Plans]`
   `path = /plans`
   `read only = Yes`
   `guest ok = Yes`

5. Verify that the `/etc/hosts` file contains the following entry:

       192.168.1.1	server

6. Use the standard system tool to start Samba and to configure it to restart automatically at every system reboot. For example:

       root#  chkconfig smb on
       root#  /etc/rc.d/init.d/smb restart

Procedure 2.2. Windows Client Configuration

1. Make certain that all clients are set to the same network address range as has been used for the Samba server. For example, one client might have an IP address 192.168.1.10.

2. Ensure that the netmask used on the Windows clients matches that used for the Samba server. All clients must have the same netmask. For example, 255.255.255.0.

3. Set the workgroup name on all clients to `MIDEARTH`.

4. Verify on each client that the machine called `SERVER` is visible in the Network Neighborhood, that it is possible to connect to it and see the share Plans, and that it is possible to open that share to reveal its contents.

#### Validation

The first priority in validating the new Samba configuration should be to check that Samba answers on the loop-back interface. Then it is time to check that Samba answers its own name correctly. Last, check that a client can connect to the Samba server.

1. To check the ability to access the smbd daemon services, execute the following:

       root#  smbclient -L localhost -U%
               Sharename     Type     Comment
               ---------     ----     -------
               Plans         Disk
               IPC$          IPC      IPC Service (Samba 3.0.12)
               ADMIN$        IPC      IPC Service (Samba 3.0.12)

               Server             Comment
               ---------          -------
               SERVER             Samba 3.0.12

               Workgroup          Master
               ---------          --------
               MIDEARTH           SERVER

   This indicates that Samba is able to respond on the loopback interface to a NULL connection. The `-U%` means send an empty username and an empty password. This command should be repeated after Samba has been running for 15 minutes.

2. Now verify that Samba correctly handles being passed a username and password, and that it answers its own name. Execute the following:

       root#  smbclient -L server -Uroot%password

   The output should be identical to the previous response. Samba has been configured to ignore all usernames given; instead it uses the `guest account` for all connections.

3. From the Windows 9x/Me client, launch Windows Explorer, [Desktop: right-click] Network Neighborhood+Explore->[Left Panel] [+] Entire Network->[Left Panel] [+] Server->[Left Panel] [+] Plans. In the right panel you should see the files and directories (folders) that are in the Plans share.

### Charity Administration Office

The fictitious charity organization is called Abmas Vision NL. This is an office that has five networked computers. Staff are all volunteers with frequent staff changes. Ms. Amy May, the director of operations, wants a no-hassle network. Anyone should be able to use any PC. Only two Windows applications are used: a custom funds tracking and management package that stores all files on the central server and Microsoft Word. The office prepares mail-out letters, letters of invitation, and thank-you notes. All files must be stored in perpetuity. The custom funds tracking and management (FTM) software has been configured to use a server named `SERVER`, a share named `FTMFILES`, and a printer queue named `PRINTQ` that uses preprinted stationery, thus demanding a dedicated printer. This printer does not need to be mapped to a local printer on the workstations.

The FTM software has been in use since the days of Windows 3.11. The software was configured by the vendor who has since gone out of business. The name of the identities of the file server and the printer are hard coded in a configuration file that was created using a setup tool that the vendor did not provide to Abmas Vision NL or to its predecessors. The company that produced the software is no longer in business. In order to avoid risk of any incompatibilities the share name and the name of the target print queue is being set precisely as the application expects. In actual fact, share names and print queue names should be treated as case insensitive (i.e.: Case does not matter) but Abmas Vision claim that if the share name is not in lower case the application claims it can not find the file share.

Printer handling in Samba results in a significant level of confusion. Samba presents to the MS Windows client only a print queue. The Samba smbd process passes a print job sent to it from the Windows client to the native UNIX printing system. The native UNIX printing system (spooler) places the job in a print queue from which it is delivered to the printer. In this book, network diagrams refer to a printer by the name of the print queue that services that printer. It does not matter what the fully qualified name (or the host name) of a network attached printer is. The UNIX print spooler is configured to correctly deliver all jobs to the printer.

This organization has a policy forbidding use of privately owned computers on site as a measure to prevent leakage of confidential information. Only the five PCs owned by Abmas Vision NL are used on this network.

The central server was donated by a local computer store. It is a dual processor Pentium-III server, has 1GB RAM, a 3-Ware IDE RAID Controller that has 4 x 200GB IDE hard drives, and a 100-base-T network card. The office has 100-base-T permanent network connections that go to a central hub and all equipment is new. The five network computers all are equipped with Microsoft Windows Me. Funding is limited, so the server has no operating system on it. You have approval to install Samba on Linux, but just make sure it works without problems. There are two HP LaserJet 5 PS printers that are network connected. The second printer is to be used for general office and letter printing. Your recommendation to allow only the Linux server to print directly to the printers was accepted. You have supplied SUSE Enterprise Linux Server 9 and have upgraded Samba to version 3.0.12.

#### Dissection and Discussion

This installation demands simplicity. Frequent turn-over of volunteer staff would indicate that a network environment that requires users to logon might be problematic. It is suggested that the best solution for this office would be one where the user can log onto any PC with any username and password. Samba can accommodate an office like this by using the `force user` parameter in share and printer definitions. The use of the `force user` ensures that all files are owned by same user identifier (UID) and thus ensures that there will never be a problem with file access due to file access permissions. Additionally, you elect to use the `nt acl support = No` option to ensure that no attempts can be made to write access control lists (Posix type) to any file or directory. This prevents an inadvertent ACL from overriding actual file permissions.

This organization is a prime candidate for Share Mode security. The `force user` allows all files to be owned by the same user and group. In addition to this, it would not hurt to set SUID and set SGID shared directories. This means that all new files that are created, no matter who creates it, are owned by the owner or group of the directory in which they are created. For further information regarding the significance of the SUID/SGID settings, see ???.

All client workstations print to a print queue on the server. This ensures that print jobs continue to print in the event that a user may shut down the workstation immediately after sending a job to the printer. Today, both Red Hat Linux and SUSE Linux use CUPS-based printing. Older Linux systems offered a choice to use either the LPRng printing system, or CUPS. It appears, however, that CUPS has now become the leading UNIX printing technology.

The print queues are set up as `Raw` devices, which means that CUPS will not do intelligent print processing, and vendor supplied drivers be installed locally on the Windows clients.

The hypothetical software (Funds Tracking and Management) referred to is representative of custom-built software that directly uses a NetBIOS interface. Most such software originated in the days of MS/PC DOS. NetBIOS names are upper-case (and functionally are case insensitive), thus some old software applications would permit only upper-case names to be entered. Some such applications were later ported to MS Windows but retain the upper-case network resource naming conventions because customers are familiar with that. We made the decision to name shares and print queues for this application in upper-case also for the same reason. Nothing would break if you were to use lower-case names, but that decision might create a need to re-educate staff something well avoided at this time.

NetBIOS networking does not print directly to a printer. Instead, all printing is done to a print queue. The print spooling system is responsible for communicating with the physical printer. In this example, therefore, the resource that is referred to as `PRINTQ` really is just a print queue. The name of the print queue is held to be representative of the device to which the print spooler delivers print jobs.

#### Implementation

It is assumed that the server is fully installed and ready for configuration of Samba 3.0.12 and for necessary support files. All TCP/IP addresses should be hard coded. In our case, the IP address of the Samba server is 192.168.1.1 and the netmask is 255.255.255.0. The host name of the server used was `server`. The office network is built as shown in ???.

Figure 2.1. Charity Administration Office Network

Procedure 2.4. Samba Server Configuration

1. Create a group account for office file storage as follows:

       root#  groupadd office

2. Create a user account for office file storage as follows:

       root#  useradd -m abmas
       root#  passwd abmas
       Changing password for abmas.
       New password: XXXXXXXX
       Re-enter new password: XXXXXXXX
       Password changed

   where XXXXXXXX is a secret password.

3. Use the 3-Ware IDE RAID Controller firmware utilities to configure the four 200GB drives as a single RAID level 5 drive, with one drive set aside as the hot spare. (Refer to the 3-Ware RAID Controller Manual for the manufacturers' preferred procedure.) The resulting drive has a capacity of approximately 500GB of usable space.

4. Create a mount point for the file system that can be used to store all data files. Create a directory called `/data` as follows:

       root#  mkdir /data
       root#  chmod 755 /data

   The 755 permissions on this directory (mount point) permit the owner to read, write and execute, and the group and everyone else to read and execute only.

5. Use SUSE Linux system tools (refer to the SUSE Administrators Guide for correct procedures) to format the partition with a suitable file system. The reiserfs file system is suitable. Configure this drive to automount using the `/data` directory as the mount point. It must be mounted before proceeding.

6. Under the directory called `/data` create two directories named `ftmfiles` and `officefiles`, and set ownership and permissions as follows:

       root#  mkdir -p /data/{ftmfiles,officefiles/{letters,invitations,misc}}
       root#  chown -R abmas.office /data
       root#  chmod -R ug+rwxs,o-w,o+rx /data

   These demonstrate compound operations. The mkdir command creates in one step these directories:

       /data/fmtfiles
       /data/officefiles
       /data/officefiles/letters
       /data/officefiles/invitations
       /data/officefiles/misc

   The chown operation sets the owner to the user `abmas` and the group to `office` on all directories just created. And the chmod operation recursively sets the permissions so that the owner and group have SUID/SGID with read/write/execute permission, and everyone else has read and execute permission. This means that all files and directories are created with the same owner and group as the directory in which they are created. Any new directories created still have the same owner, group, and permissions as the directory they are in. This should eliminate all permissions-based file access problems. For more information on this subject, refer to TOSHARG, Chapter 13, File, Directory and Share Access Controls, or refer to the UNIX man page for the chmod and the chown commands.

7. Install the `smb.conf` file shown in ??? in the `/etc/samba` directory.

8. We must ensure that the smbd can resolve the name of the Samba server to its IP address. Verify that the `/etc/hosts` file contains the following entry:

       192.168.1.1	server

9. Configure the printers with the IP address as shown in ???. Follow the instructions in the manufacturers' manual to permit printing to port 9100, so that the CUPS spooler can print using raw mode protocols.

10. Configure the CUPS Print Queues as follows:

        root#  lpadmin -p PRINTQ -v socket://192.168.1.20:9100 -E
        root#  lpadmin -p hplj5 -v socket://192.168.1.30:9100 -E

    This creates the necessary print queues with no assigned print filter.

11. Edit the file `/etc/cups/mime.convs` to uncomment the line:

        application/octet-stream     application/vnd.cups-raw      0     -

12. Edit the file `/etc/cups/mime.types` to uncomment the line:

        application/octet-stream

13. Use the standard system tool to start Samba and CUPS to configure them to restart automatically at every system reboot. For example:

        root#  chkconfig smb on
        root#  chkconfig cups on
        root#  /etc/rc.d/init.d/smb restart
        root#  /etc/rc.d/init.d/cups restart

Example 2.2. Charity Administration Office smb.conf File

# Global Parameters
`[global]`
`workgroup = MIDEARTH`
`security = SHARE`
`printing = CUPS`
`printcap name = CUPS`
`disable spoolss = Yes`
`show add printer wizard = No`
`wins support = yes`
`[FTMFILES]`
`comment = Funds Tracking & Management Files`
`path = /data/ftmfiles`
`read only = No`
`force user = abmas`
`force group = office`
`guest ok = Yes`
`nt acl support = No`
`[office]`
`comment = General Office Files`
`path = /data/officefiles`
`read only = No`
`force user = abmas`
`force group = office`
`guest ok = Yes`
`nt acl support = No`
`[printers]`
`comment = Print Temporary Spool Configuration`
`path = /var/spool/samba`
`printable = Yes`
`guest ok = Yes`
`use client driver = Yes`
`browseable = No`

Procedure 2.5. Windows Client Configuration

1. Configure clients to the network settings shown in ???.

2. Ensure that the netmask used on the Windows clients matches that used for the Samba server. All clients must have the same netmask. For example, `255.255.255.0`.

3. On all Windows clients, set the WINS Server address to `192.168.1.1`, the IP address of the server.

4. Set the workgroup name on all clients to `MIDEARTH`.

5. Install the “Client for Microsoft Networks.” Ensure that the only option enabled in its properties is the option “Logon and restore network connections.”

6. Click OK when you are prompted to reboot the system. Reboot the system, then logon using any user name and password you choose.

7. Verify on each client that the machine called `SERVER` is visible in My Network Places, that it is possible to connect to it and see the share office, and that it is possible to open that share to reveal its contents.

8. Disable password caching on all Windows 9x/Me machines using the registry change file shown in ???. Be sure to remove all files that have the `PWL` extension that are in the `C:\WINDOWS` directory.

   Example 2.3. Windows Me Registry Edit File: Disable Password Caching

       REGEDIT4

       [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\
       	Windows\CurrrentVersion\Policies\Network]
       	"DisablePwdCaching"=dword:00000001

   The best way to apply this is to save the patch in a file called `ME-dpwc.reg` and then execute:

       C:\WINDOWS: regedit ME-dpwc.reg

9. Instruct all users to log onto the workstation using a name of their own choosing, with a password of their own choosing. The Samba server has been configured to ignore the username and password given.

10. On each Windows Me workstation, configure a network drive mapping to drive `G:` that redirects to the uniform naming convention (UNC) resource `\\server\office`. Make this a permanent drive connection as follows:

    1. (Right-click) My Network->Map Network Drive...

    2. In the box labeled “Drive:”, type G.

    3. In the box labeled “Path:”, enter `\\server\officefiles`.

    4. Click Reconnect at logon. Click OK.

11. On each workstation, install the Funds Tracking and Management software following the manufacturer's instructions.

    1. During installation, you are prompted for the name of the Windows 98 server. Enter the name `SERVER`.

    2. You are prompted for the name of the data share. The prompt defaults to `FTMFILES`. Press enter to accept the default value.

    3. You are now prompted for the print queue name. The default prompt is the name of the server you entered (`SERVER` as follows: `\\SERVER\PRINTQ`). Simply accept the default and press enter to continue. The software now completes the installation.

12. Install an office automation software package of the customer's choice. Either Microsoft Office 2003 Standard or OpenOffice 1.1.0 suffices for any functions the office may need to perform. Repeat this on each workstation.

13. Install a printer on each using the following steps:

    1. Click Start->Settings->Printers+Add Printer+Next. Do not click Network printer. Ensure that Local printer is selected.

    2. Click Next. In the panel labeled Manufacturer:, select `HP`. In the Printers: panel, select the printer called `HP LaserJet 5/5M Postscript`. Click Next.

    3. In the panel labeled Available ports:, select `FILE:`. Accept the default printer name by clicking Next. When asked, “Would you like to print a test page?”, click No. Click Finish.

    4. You may be prompted for the name of a file to print to. If so, close the dialog panel. Right-click HP LaserJet 5/5M Postscript->Properties->Details (Tab)->Add Port.

    5. In the panel labeled Network, enter the name of the print queue on the Samba server as follows: `\\SERVER\hplj5`. Click OK+OK to complete the installation.

    6. It is a good idea to test the functionality of the complete installation before handing the newly configured network over to the Charity Administration Office for production use.

#### Validation

Use the same validation process as was followed in ???.

### Accounting Office

The office of Abmas Accounting Inc. is a 40-year-old family-run business. There are nine permanent computer users. The network clients were upgraded two years ago. All computers run Windows 2000 Professional. This year the server will be upgraded from an old Windows NT4 server (actually running Windows NT4 Workstation, which worked fine as there were fewer than 10 users) that has run in workgroup (Stand-Alone) mode, to a new Linux server running Samba.

The office does not want a Domain Server. Mr. Alan Meany wants to keep the Windows 2000 Professional clients running as workgroup machines so that any staff member can take a machine home and keep working. It has worked well so far and your task is to replace the old server. All users have their own workstation logon (you configured it that way when the machines were installed). Mr. Meany wants the new system to operate the same way as the old Windows NT4 server users cannot access each others' files, but he can access everyone's files. Each person's work files are in a separate share on the server. Users logon to their Windows workstation with their username and enter an assigned password; they do not need to enter a password when accessing their files on the server.

The new server will run Red Hat Fedora Core2. You should install Samba-3.0.12 and copy all files off the old system to the new one. The existing Windows NT4 server has a parallel port HP LaserJet 4 printer that is shared by all. The printer driver is installed on each workstation. You must not change anything on the workstations. Mr. Meany gave instructions to replace the server “but leave everything else alone to avoid staff unrest.”

You have tried to educate Mr. Meany and found that he has no interest to understand networking. He believes that Windows for Workgroups 3.11 was “the best server Microsoft ever sold ” and that Windows NT and 2000 are “too fang-dangled complex!”

#### Dissection and Discussion

The requirements of this network installation are not unusual. The staff are not interested in the details of networking. Passwords are never changed. In this example solution, we demonstrate the use of User Mode security in a simple context. Directories should be set SGID to ensure that members of a common group can access the contents. Each user has his or her own share to which only they can connect. Mr. Meany's share will be a top level directory above the share point for each employee. Mr. Meany is a member of the same group as his staff and is able to access their work files. The well used HP LaserJet 4 is available as a service called `hplj`.

You have finished configuring the new hardware and have just completed installation of Red Hat Fedora Core2. Roll up your sleeves and let's get to work.

#### Implementation

The workstations have fixed IP addresses. The old server runs Windows NT4 Workstation, so it cannot be running as a WINS server. It is best that the new configuration preserves the same configuration. The office does not use Internet access, so security really is not an issue.

The core information regarding the users, their passwords, the directory share point, and the share name is given in ???. The overall network topology is shown in ???. All machines have been configured as indicated prior to the start of Samba configuration. The following prescriptive steps may now commence.

Figure 2.2. Accounting Office Network Topology

Table 2.1. Accounting Office Network Information

User | Login-ID | Password | Share Name | Directory | Wkst
--- | --- | --- | --- | --- | ---
Alan Meany | alan | alm1961 | alan | /data | PC1
James Meany | james | jimm1962 | james | /data/james | PC2
Jeannie Meany | jeannie | jema1965 | jeannie | /data/jeannie | PC3
Suzy Millicent | suzy | suzy1967 | suzy | /data/suzy | PC4
Ursula Jenning | ujen | ujen1974 | ursula | /data/ursula | PC5
Peter Pan | peter | pete1984 | peter | /data/peter | PC6
Dale Roland | dale | dale1986 | dale | /data/dale | PC7
Bertrand E Paoletti | eric | eric1993 | eric | /data/eric | PC8
Russell Lewis | russ | russ2001 | russell | /data/russell | PC9

Procedure 2.9. Migration from Windows NT4 Workstation System to Samba-3

1. Rename the old server from `CASHPOOL` to `STABLE` by logging onto the console as the `Administrator`. Restart the machine following system prompts.

2. Name the new server `CASHPOOL` using the standard configuration method. Restart the machine following system prompts.

3. Install the latest Samba-3 binary Red Hat Linux RPM that is available from the Samba FTP site.

4. Add a group account for the office to use. Execute the following:

       root#  groupadd accts

5. Install the `smb.conf` file shown[4] in ???.

6. For each user who uses this system (see ???), execute the following:

       root#  useradd -m -G accts -c "Name of User" "LoginID"
       root#  passwd "LoginID"
       Changing password for user "LoginID"
       New Password: XXXXXXXXX	<-- the password from the table
       Retype new password: XXXXXXXXX
       root#  smbpasswd -a "LoginID"
       New SMB password: XXXXXXXXX <-- the password from the table
       Retype new SMB password: XXXXXXXXX
       Added user "LoginID"

7. Create the directory structure for the file shares by executing the following:

       root#  mkdir -p /data
       root#  chown alan /data
       root#  for i in james suzy ursula peter dale eric jeannie russell
       > do
       > 	mkdir -p /data/$i
       > 	chown $i /data/$i
       > done
       root#  chgrp -R accts /data
       root#  chmod -R ug+rwxs,o-r+x /data

   The data storage structure is now prepared for use.

8. Configure the CUPS Print Queues as follows:

       root#  lpadmin -p hplj -v parallel:/dev/lp0 -E

   This creates the necessary print queues with no assigned print filter.

9. Edit the file `/etc/cups/mime.convs` to uncomment the line:

       application/octet-stream     application/vnd.cups-raw      0     -

10. Edit the file `/etc/cups/mime.types` to uncomment the line:

        application/octet-stream

11. Use the standard system tool to start Samba and CUPS to configure them to restart automatically at every system reboot. For example:

        root#  chkconfig smb on
        root#  chkconfig cups on
        root#  /etc/rc.d/init.d/smb restart
        root#  /etc/rc.d/init.d/cups restart

12. On Alan's workstation, use Windows explorer to migrate the files from the old server to the new server. The new server should appear in the Network Neighborhood with the name of the old server (`CASHPOOL`).

    1. Logon to Alan's workstation as the user `alan`.

    2. Launch a second instance of Windows explorer and navigate to the share called files on the server called STABLE.

    3. Click in the right panel, and press Ctrl-A to select all files and directories. Press Ctrl-C to instruct Windows that you wish to copy all selected items.

    4. Launch the Windows explorer, and navigate to the share called files on the server called CASHPOOL. Click in the right panel, and then press Ctrl-V to commence the copying process.

13. Verify that the files are being copied correctly from the Windows NT4 machine to the Samba-3 server. This is best done on the Samba-3 server. Check the contents of the directory tree under `/data`. This can be done by executing the following command:

        root#  ls -aR /data

    Make certain to check the ownership and permissions on all files. If in doubt, execute the following:

        root#  chown alan /data
        root#  for i in james suzy ursula peter dale eric jeannie russell
        > do
        > 	chown $i /data/$i
        > done
        root#  chgrp -R accts /data
        root#  chmod -R ug+rwxs,o-r+x /data

14. The migration of all data should now be complete. It is time to validate the installation. For this, you should make sure all applications, including printing, work before asking the customer to test drive the new network.

Example 2.4. Accounting Office Network smb.conf File

# Global parameters
`[global]`
`workgroup = BILLMORE`
`printing = CUPS`
`printcap name = CUPS`
`disable spoolss = Yes`
`show add printer wizard = No`
`[files]`
`comment = Work area files`
`path = /data/%U`
`valid users = %S`
`read only = No`
`[master]`
`comment = Master work area files`
`path = /data`
`valid users = alan`
`read only = No`
`[printers]`
`comment = Print Temporary Spool Configuration`
`path = /var/spool/samba`
`printable = Yes`
`guest ok = Yes`
`use client driver = Yes`
`browseable = No`

## Questions and Answers

The following questions and answers draw from the examples in this chapter. Many design decisions are impacted by the configurations chosen. The intent is to expose some of the hidden implications.

What makes an anonymous Samba server more simple than an non-anonymous Samba server?
How is the operation of the parameter force user different from setting the root directory of the share SUID?
When would you use both the per share parameter force user as well as setting the share root directory SUID?
What is better about CUPS printing than LPRng printing?
When should Windows client IP addresses be hard coded?
Under what circumstances would it be best to use a DHCP server?
What is the purpose of setting the parameter guest ok on a share?
When would you set the global parameter disable spoolss?
Why would you disable password caching on Windows 9x/Me clients?
The example of Abmas Accounting Inc. uses User Mode security. How does this provide anonymous access?

| What makes an anonymous Samba server more simple than an non-anonymous Samba server?
| In the anonymous server, the only account used is the `guest` account. In a non-anonymous configuration, it is necessary to add real user accounts to both the UNIX system and to the Samba configuration. Non-anonymous servers require additional administration.
| How is the operation of the parameter `force user` different from setting the root directory of the share SUID?

The parameter `force user` causes all operations on the share to assume the UID of the forced user. The new default GID that applies is the primary GID of the forced user. This gives all users of this resource the actual privilege of the forced user.

When a directory is set SUID, the operating system forces files that are written within it to be owned by the owner of the directory. While this happens, the user who is using the share has only the level of privilege he or she is assigned within the operating system context.

The parameter `force user` has potential security implications that go beyond the actual share root directory. Be careful and wary of using this parameter.

| When would you use both the per share parameter `force user` as well as setting the share root directory SUID?
| You would use both parameters when it is necessary to guarantee that all share handling operations are conducted as the forced user, while all file and directory creation are done as the SUID directory owner.
| What is better about CUPS printing than LPRng printing?

CUPS is a print spooling system that has integrated remote management facilities, provides completely automated print processing/preprocessing, and has the potential to be configured to automatically apply print preprocessing filters to ensure that a print job submitted is correctly rendered for the target printer. CUPS includes an image file RIP that supports printing of image files to non-PostScript printers. CUPS has lots of bells and whistles and is more like a super-charged MS Windows NT/200x print monitor and processor. Its complexity can be eliminated or turbo-charged to suit any fancy.

The LPRng software is an enhanced, extended, and portable implementation of the Berkeley LPR print spooler functionality. It provides the same interface and meets RFC1179 requirements. LPRng is capable of being configured to act like CUPS, but it is in principle a replacement for the old Berkeley lpr/lpd spooler. LPRng is generally preferred by those who are familiar with Berkeley lpr/lpd.

Which is better is a matter of personal taste. It depends on what you want to do and how you want to do it and manage it. Most modern Linux systems ship with CUPS as the default print management system.

| When should Windows client IP addresses be hard coded?

When there are few MS Windows clients, little client change, no mobile users, and users are not inclined to tamper with network settings, it is a safe and convenient matter to hard-code Windows client TCP/IP settings. Given that it is possible to lock down the Windows desktop and remove user ability to access network configuration controls, fixed configuration eliminates the need for a DHCP server. This reduces maintenance overheads and eliminates a possible point of network failure.

| Under what circumstances would it be best to use a DHCP server?

In network configurations where there are mobile users, or where Windows client PCs move around (particularly between offices or between subnets), it makes complete sense to control all Windows client configurations using a DHCP server. Additionally, when users do tamper with the network settings, the use of DHCP can be used to normalize all client settings.

One of the least appreciated benefits of using a DHCP server to assign all network client device TCP/IP settings is that it makes it a pain-free process to change network TCP/IP settings, change network addressing, or enhance the ability of client devices to benefit from new network services.

Another benefit of modern DHCP servers is the ability of the DHCP server to register dynamically assigned IP addresses with the DNS server. The benefits of Dynamic DNS (DDNS) are considerable in a large Windows network environment.

| What is the purpose of setting the parameter `guest ok` on a share?
| If this parameter is yes for a service, then no password is required to connect to the service. Privileges are those of the guest account.
| When would you set the global parameter `disable spoolss`?

Setting this parameter to `Yes` disables Samba's support for the SPOOLSS set of MS-RPC's and yields behavior identical to Samba 2.0.x. Windows NT/2000 clients can downgrade to using LanMan style printing commands. Windows 9x/ME are unaffected by the parameter. However, this disables the ability to upload printer drivers to a Samba server via the Windows NT/200x Add Printer Wizard or by using the NT printer properties dialog window. It also disables the capability of Windows NT/200x clients to download print drivers from the Samba host on demand. Be extremely careful about setting this parameter.

The alternate parameter `use client driver` applies only to Windows NT/200x clients. It has no effect on Windows 95/98/ME clients. When serving a printer to Windows NT/200x clients without first installing a valid printer driver on the Samba host, the client is required to install a local printer driver. From this point on, the client treats the printer as a local printer and not a network printer connection. This is much the same behavior that occurs when `disable spoolss = yes`.

Under normal circumstances, the NT/200x client attempts to open the network printer using MS-RPC. Because the client considers the printer to be local, it attempts to issue the OpenPrinterEx() call requesting access rights associated with the logged on user. If the user possesses local administrator rights but not root privilege on the Samba host (often the case), the OpenPrinterEx() call fails. The result is that the client now displays an "Access Denied; Unable to connect" message in the printer queue window (even though jobs may be printed successfully). This parameter MUST not be enabled on a print share that has valid print driver installed on the Samba server.

| Why would you disable password caching on Windows 9x/Me clients?

Windows 9x/Me workstations that are set at default (password caching enabled) store the username and password in files located in the Windows master directory. Such files can be scavenged (read off a client machine) and decrypted, thus revealing the user's access credentials for all systems the user may have accessed. It is most insecure to allow any Windows 9x/Me client to operate with password caching enabled.

| The example of Abmas Accounting Inc. uses User Mode security. How does this provide anonymous access?

The example used does not provide anonymous access. Since the clients are all Windows 2000 Professional, and given that users are logging onto their machines, by default the client attempts to connect to a remote server using currently logged in user credentials. By ensuring that the user's login ID and password is the same as those set on the Samba server, access is transparent and does not require separate user authentication.

[2] The examples given mirror those documented in TOSHARG Chapter 2, Section 2.3.1. You may gain additional insight from the Stand-alone server configurations covered in TOSHARG sections 2.3.1.2 through 2.3.1.4.

[3] This information is given purely as an example of how data may be stored in such a way that it will be easy to locate records at a later date. The example is not meant to imply any instructions that may be construed as essential to the design of the solution, this is something you will almost certainly want to determine for yourself.

[4] This example makes use of the `smbpasswd` file. It does so in an obtuse way since the use of the `passdb backend` has not been specified in the `smb.conf` file. This means that you are depending on correct default behavior.

Prev | Up | Next
Chapter 1. Networking Primer | Home | Chapter 3. Small Office Networking