Home > Articles

Samba-3: A Simple Anonymous Read-Write Server

📄 Contents

  1. Charity Administration Office
  2. Conclusion
  • Print
  • + Share This
A manager once said, "If it is more difficult than plucking a tissue from the Kleenex® box, my staff won't use it!" This example network is easier to configure and use than that! This installation will again show just how simple, yet effective, Samba-3 can be.
Like this article? We recommend

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 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.

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 article, 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 version 8.0 and have upgraded Samba to version 3.0.2.

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 Appendix A.6 (not available here – see Samba-3 by Example book).

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 best 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.2 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.

Figure 2.1FIGURE 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 Example 2.2. 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 Figure 2.1. 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 Figure 2.1.

  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 Example 2.3. 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\officefiles. 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.

    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

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
            ---------     ----     -------
            FMTFILES      Disk
            Office        Disk
            IPC$          IPC      IPC Service (Samba 3.0.2)
            ADMIN$        IPC      IPC Service (Samba 3.0.2)
            PRINTQ        Printer  PRINTQ
            hplj5         Printer  hplj5
    
            Server             Comment
            ---------          -------
            SERVER             Samba 3.0.2
    
            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.

  • + Share This
  • 🔖 Save To Your Account

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020