From c57096cb03951c9e849858d5b10f56ed462e936a Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Thu, 3 Apr 2003 17:44:51 +0000 Subject: Update manpages for 3.0 (This used to be commit edd15d36f528b64f3ab961908bcd43111e08244b) --- docs/htmldocs/Samba-HOWTO-Collection.html | 13613 ++++++++++++++-------------- 1 file changed, 6892 insertions(+), 6721 deletions(-) (limited to 'docs/htmldocs') diff --git a/docs/htmldocs/Samba-HOWTO-Collection.html b/docs/htmldocs/Samba-HOWTO-Collection.html index c902d63bec..73bc3eb60a 100644 --- a/docs/htmldocs/Samba-HOWTO-Collection.html +++ b/docs/htmldocs/Samba-HOWTO-Collection.html @@ -219,8 +219,8 @@ HREF="#AEN546" >
3.8. Passdb XML pluginXML
4.1. Stand Alone Server
4.2. Domain Member Server
4.3. Domain Controller
5.1. User and Share security level
6.1. Prerequisite Reading
6.2. Background
6.3. Configuring the Samba Domain Controller
6.4. Creating Machine Trust Accounts and Joining Clients to the Domain
6.5. Common Problems and Errors
6.6. What other help can I get?
6.7. Domain Control for Windows 9x/ME
7.1. Prerequisite Reading
7.2. Background
7.3. What qualifies a Domain Controller on the network?
7.4. Can Samba be a Backup Domain Controller to an NT PDC?
7.5. How do I set up a Samba BDC?
8.1. Setup your smb.conf
8.2. Setup your /etc/krb5.conf
8.3. Create the computer account
8.4. Test your server setup
8.5. Testing with smbclient
8.6. Notes
9.1. Joining an NT Domain with Samba 3.0
9.2. Why is this better than security = server?
10. System PoliciesAdvanced Network Manangement Information
10.1. Basic System Policy Info
10.2. Roaming ProfilesRemote Server Administration
11.1. Viewing and changing UNIX permissions using the NT security dialogs
11.2. How to view file security on a Samba share
11.3. Viewing file ownership
11.4. Viewing file or directory permissions
11.5. Modifying file or directory permissions
11.6. Interaction with the standard Samba create mask parameters
11.7. Interaction with the standard Samba file attribute mapping
13.1. Samba and PAM
13.2. Distributed Authentication
13.3. PAM Configuration in smb.conf
14.1. Introduction
14.2. Configuration
14.3. The Imprints Toolset
14.4. Diagnosis
15.1. Introduction
15.2. CUPS - RAW Print Through Mode
15.3. The CUPS Filter Chains
15.4. CUPS Print Drivers and Devices
15.5. Limiting the number of pages users can print
15.6. Advanced Postscript Printing from MS Windows
15.7. Auto-Deletion of CUPS spool files
16.1. Abstract
16.2. Introduction
16.3. What Winbind Provides
16.4. How Winbind Works
16.5. Installation and Configuration
16.6. Limitations
16.7. Conclusion
17. Policy Management - Hows and Whys
17.1. System Policies
18. Profile Management
18.1. Roaming Profiles
19. Integrating MS Windows networks with Samba
17.1. 19.1. Name Resolution in a pure Unix/Linux world
17.2. 19.2. Name resolution as used within MS Windows networking
18. 20. Improved browsing in samba
18.1. 20.1. Overview of browsing
18.2. 20.2. Browsing support in samba
18.3. 20.3. Problem resolution
18.4. 20.4. Browsing across subnets
18.5. 20.5. Setting up a WINS server
18.6. 20.6. Setting up Browsing in a WORKGROUP
18.7. 20.7. Setting up Browsing in a DOMAIN
18.8. 20.8. Forcing samba to be the master
18.9. 20.9. Making samba the domain master
18.10. 20.10. Note about broadcast addresses
18.11. 20.11. Multiple interfaces
19. 21. Hosting a Microsoft Distributed File System tree on Samba
19.1. 21.1. Instructions
20. 22. Stackable VFS modules
20.1. 22.1. Introduction and configuration
20.2. 22.2. Included modules
20.3. 22.3. VFS modules available elsewhere
21. 23. Securing Samba
21.1. 23.1. Introduction
21.2. 23.2. Using host based protection
21.3. 23.3. Using interface protection
21.4. 23.4. Using a firewall
21.5. 23.5. Using a IPC$ share deny
21.6. 23.6. Upgrading Samba
22. 24. Unicode/Charsets
22.1. 24.1. What are charsets and unicode?
22.2. 24.2. Samba and charsets
23. 25. Samba performance issues
23.1. 25.1. Comparisons
23.2. 25.2. Socket options
23.3. 25.3. Read size
23.4. 25.4. Max xmit
23.5. 25.5. Log level
23.6. 25.6. Read raw
23.7. 25.7. Write raw
23.8. 25.8. Slow Clients
23.9. 25.9. Slow Logins
23.10. 25.10. Client tuning
24. 26. Portability
24.1. 26.1. HPUX
24.2. 26.2. SCO Unix
24.3. 26.3. DNIX
24.4. 26.4. RedHat Linux Rembrandt-II
24.5. 26.5. AIX
25. 27. Samba and other CIFS clients
25.1. 27.1. Macintosh clients?
25.2. 27.2. OS2 Client
25.3. 27.3. Windows for Workgroups
25.4. 27.4. Windows '95/'98
25.5. 27.5. Windows 2000 Service Pack 2
26. 28. How to compile SAMBA
26.1. 28.1. Access Samba source code via CVS
26.2. 28.2. Accessing the samba sources via rsync and ftp
26.3. 28.3. Building the Binaries
26.4. 28.4. Starting the smbd and nmbd
27. 29. Reporting Bugs
27.1. 29.1. Introduction
27.2. 29.2. General info
27.3. 29.3. Debug levels
27.4. 29.4. Internal errors
27.5. 29.5. Attaching to a running process
27.6. 29.6. Patches
28. 30. The samba checklist
28.1. 30.1. Introduction
28.2. 30.2. Assumptions
28.3. 30.3. Tests
28.4. 30.4. Still having troubles?
3.7.1. Building
3.7.2. Creating the database
3.7.3. 3.7.2. Configuring
3.7.4. 3.7.3. Using plaintext passwords or encrypted password
3.7.5. 3.7.4. Getting non-column data from the table
3.8. Passdb XML plugin
3.8.1. Building
3.8.2. UsageXML
3.7.1. Building

To build the plugin, run make bin/pdb_mysql.so -in the source/ directory of samba distribution.

Next, copy pdb_mysql.so to any location you want. I -strongly recommend installing it in $PREFIX/lib or /usr/lib/samba/


3.7.2. Creating the database3.7.1. Creating the database

You either can set up your own table and specify the field names to pdb_mysql (see below @@ -3492,8 +3475,8 @@ CLASS="SECT2" >


3.7.3. Configuring3.7.2. Configuring

This plugin lacks some good documentation, but here is some short info:

:
passdb backend = [other-plugins] plugin:/location/to/pdb_mysql.so:identifier [other-plugins]
passdb backend = [other-plugins] mysql:identifier [other-plugins]

The identifier can be any string you like, as long as it doesn't collide with @@ -3603,8 +3586,8 @@ CLASS="SECT2" >


3.7.4. Using plaintext passwords or encrypted password3.7.3. Using plaintext passwords or encrypted password

I strongly discourage the use of plaintext passwords, however, you can use them:


3.7.5. Getting non-column data from the table3.7.4. Getting non-column data from the table

It is possible to have not all data in the database and making some 'constant'.


3.8. Passdb XML plugin3.8. XML

3.8.1. Building

This module requires libxml2 to be installed.

To build pdb_xml, run: make bin/pdb_xml.so in -the directory source/.


3.8.2. Usage

The usage of pdb_xml is pretty straightforward. To export data, use: pdbedit -e plugin:/usr/lib/samba/pdb_xml.so:filenamepdbedit -e xml:filename (where filename is the name of the file to put the data in)

To import data, use: pdbedit -i plugin:/usr/lib/samba/pdb_xml.so:filename -e current-pdbpdbedit -i xml:filename -e current-pdb Where filename is the name to read the data from and current-pdb to put it in.

Introduction

4.1. Stand Alone Server
4.2. Domain Member Server
4.3. Domain Controller
4.3.1. Domain Controller Types
5.1. User and Share security level
5.1.1. User Level Security
5.1.2. Share Level Security
5.1.3. Server Level Security
5.1.4. Domain Level Security
5.1.5. ADS Level Security
6.1. Prerequisite Reading
6.2. Background
6.3. Configuring the Samba Domain Controller
6.4. Creating Machine Trust Accounts and Joining Clients to the Domain
6.4.1. Manual Creation of Machine Trust Accounts
6.4.2. "On-the-Fly" Creation of Machine Trust Accounts
6.4.3. Joining the Client to the Domain
6.5. Common Problems and Errors
6.6. What other help can I get?
6.7. Domain Control for Windows 9x/ME
6.7.1. Configuration Instructions: Network Logons
7.1. Prerequisite Reading
7.2. Background
7.3. What qualifies a Domain Controller on the network?
7.3.1. How does a Workstation find its domain controller?
7.3.2. When is the PDC needed?
7.4. Can Samba be a Backup Domain Controller to an NT PDC?
7.5. How do I set up a Samba BDC?
7.5.1. How do I replicate the smbpasswd file?
7.5.2. Can I do this all with LDAP?
8.1. Setup your smb.conf
8.2. Setup your /etc/krb5.conf
8.3. Create the computer account
8.3.1. Possible errors
8.4. Test your server setup
8.5. Testing with smbclient
8.6. Notes
9.1. Joining an NT Domain with Samba 3.0
9.2. Why is this better than security = server?

4.1. Stand Alone Server


4.2. Domain Member Server


4.3. Domain Controller


4.3.1. Domain Controller Types


5.1. User and Share security level


5.1.1. User Level Security


5.1.2. Share Level Security


5.1.3. Server Level Security


5.1.3.1. Configuring Samba for Seemless Windows Network Integration


5.1.3.2. Use MS Windows NT as an authentication server


5.1.4. Domain Level Security


5.1.4.1. Samba as a member of an MS Windows NT security domain


5.1.5. ADS Level Security

6.1. Prerequisite Reading


6.2. Background


6.3. Configuring the Samba Domain Controller


6.4. Creating Machine Trust Accounts and Joining Clients to the Domain


6.4.1. Manual Creation of Machine Trust Accounts


6.4.2. "On-the-Fly" Creation of Machine Trust Accounts


6.4.3. Joining the Client to the Domain


6.5. Common Problems and Errors


6.6. What other help can I get?


6.7. Domain Control for Windows 9x/ME


6.7.1. Configuration Instructions: Network Logons

7.1. Prerequisite Reading


7.2. Background


7.3. What qualifies a Domain Controller on the network?


7.3.1. How does a Workstation find its domain controller?


7.3.2. When is the PDC needed?


7.4. Can Samba be a Backup Domain Controller to an NT PDC?


7.5. How do I set up a Samba BDC?


7.5.1. How do I replicate the smbpasswd file?


7.5.2. Can I do this all with LDAP?


8.1. Setup your smb.conf

8.2. Setup your /etc/krb5.conf

8.3. Create the computer account


8.3.1. Possible errors


8.4. Test your server setup


8.5. Testing with smbclient


8.6. Notes

9.1. Joining an NT Domain with Samba 3.0


9.2. Why is this better than security = server?

Introduction

10. System PoliciesAdvanced Network Manangement Information
10.1. Basic System Policy Info
10.1.1. Creating Group Prolicy Files
10.2. Roaming Profiles
10.2.1. Windows NT Configuration
10.2.2. Windows 9X Configuration
10.2.3. Win9X and WinNT Configuration
10.2.4. Windows 9X Profile Setup
10.2.5. Windows NT Workstation 4.0
10.2.6. Windows NT/200x ServerRemote Server Administration
10.2.7. Sharing Profiles between W9x/Me and NT4/200x/XP workstations
10.2.8. Windows NT 4
10.2.9. Windows 2000/XP
11.1. Viewing and changing UNIX permissions using the NT security dialogs
11.2. How to view file security on a Samba share
11.3. Viewing file ownership
11.4. Viewing file or directory permissions
11.4.1. File Permissions
11.4.2. Directory Permissions
11.5. Modifying file or directory permissions
11.6. Interaction with the standard Samba create mask parameters
11.7. Interaction with the standard Samba file attribute mapping
13.1. Samba and PAM
13.2. Distributed Authentication
13.3. PAM Configuration in smb.conf
14.1. Introduction
14.2. Configuration
14.2.1. Creating [print$]
14.2.2. Setting Drivers for Existing Printers
14.2.3. Support a large number of printers
14.2.4. Adding New Printers via the Windows NT APW
14.2.5. Samba and Printer Ports
14.3. The Imprints Toolset
14.3.1. What is Imprints?
14.3.2. Creating Printer Driver Packages
14.3.3. The Imprints server
14.3.4. The Installation Client
14.4. Diagnosis
14.4.1. Introduction
14.4.2. Debugging printer problems
14.4.3. What printers do I have?
14.4.4. Setting up printcap and print servers
14.4.5. Job sent, no output
14.4.6. Job sent, strange output
14.4.7. Raw PostScript printed
14.4.8. Advanced Printing
14.4.9. Real debugging
15.1. Introduction
15.2. CUPS - RAW Print Through Mode
15.3. The CUPS Filter Chains
15.4. CUPS Print Drivers and Devices
15.4.1. Further printing steps
15.5. Limiting the number of pages users can print
15.6. Advanced Postscript Printing from MS Windows
15.7. Auto-Deletion of CUPS spool files
16.1. Abstract
16.2. Introduction
16.3. What Winbind Provides
16.3.1. Target Uses
16.4. How Winbind Works
16.4.1. Microsoft Remote Procedure Calls
16.4.2. Microsoft Active Directory Services
16.4.3. Name Service Switch
16.4.4. Pluggable Authentication Modules
16.4.5. User and Group ID Allocation
16.4.6. Result Caching
16.5. Installation and Configuration
16.5.1. Introduction
16.5.2. Requirements
16.5.3. Testing Things Out
16.6. Limitations
16.7. Conclusion
17. Integrating MS Windows networks with SambaPolicy Management - Hows and Whys
17.1. Name Resolution in a pure Unix/Linux worldSystem Policies
17.1.1. /etc/hostsCreating and Managing Windows 9x/Me Policies
17.1.2. /etc/resolv.confCreating and Managing Windows NT4 Style Policy Files
17.1.3. Creating and Managing MS Windows 200x Policies
18. Profile Management
18.1. Roaming Profiles
18.1.1. Windows NT Configuration
18.1.2. Windows 9X Configuration
18.1.3. Win9X and WinNT Configuration
18.1.4. Windows 9X Profile Setup
18.1.5. Windows NT Workstation 4.0
18.1.6. Windows NT/200x Server
18.1.7. Sharing Profiles between W9x/Me and NT4/200x/XP workstations
18.1.8. Windows NT 4
18.1.9. Windows 2000/XP
19. Integrating MS Windows networks with Samba
19.1. Name Resolution in a pure Unix/Linux world
19.1.1. /etc/hosts
19.1.2. /etc/resolv.conf
19.1.3. /etc/host.conf
17.1.4. 19.1.4. /etc/nsswitch.conf
17.2. 19.2. Name resolution as used within MS Windows networking
17.2.1. 19.2.1. The NetBIOS Name Cache
17.2.2. 19.2.2. The LMHOSTS file
17.2.3. 19.2.3. HOSTS file
17.2.4. 19.2.4. DNS Lookup
17.2.5. 19.2.5. WINS Lookup
18. 20. Improved browsing in samba
18.1. 20.1. Overview of browsing
18.2. 20.2. Browsing support in samba
18.3. 20.3. Problem resolution
18.4. 20.4. Browsing across subnets
18.4.1. 20.4.1. How does cross subnet browsing work ?
18.5. 20.5. Setting up a WINS server
18.6. 20.6. Setting up Browsing in a WORKGROUP
18.7. 20.7. Setting up Browsing in a DOMAIN
18.8. 20.8. Forcing samba to be the master
18.9. 20.9. Making samba the domain master
18.10. 20.10. Note about broadcast addresses
18.11. 20.11. Multiple interfaces
19. 21. Hosting a Microsoft Distributed File System tree on Samba
19.1. 21.1. Instructions
19.1.1. 21.1.1. Notes
20. 22. Stackable VFS modules
20.1. 22.1. Introduction and configuration
20.2. 22.2. Included modules
20.2.1. 22.2.1. audit
20.2.2. 22.2.2. recycle
20.2.3. 22.2.3. netatalk
20.3. 22.3. VFS modules available elsewhere
20.3.1. 22.3.1. DatabaseFS
20.3.2. 22.3.2. vscan
21. 23. Securing Samba
21.1. 23.1. Introduction
21.2. 23.2. Using host based protection
21.3. 23.3. Using interface protection
21.4. 23.4. Using a firewall
21.5. 23.5. Using a IPC$ share deny
21.6. 23.6. Upgrading Samba
22. 24. Unicode/Charsets
22.1. 24.1. What are charsets and unicode?
22.2. 24.2. Samba and charsets
Chapter 10. System PoliciesChapter 10. Advanced Network Manangement Information

10.1. Basic System Policy Info10.1. Remote Server Administration

Much of the information necessary to implement System Policies and -Roaming User Profiles in a Samba domain is the same as that for -implementing these same items in a Windows NT 4.0 domain. -You should read the white paper Implementing -Profiles and Policies in Windows NT 4.0 available from Microsoft.

Here are some additional details:

  • What about Windows NT Policy Editor? -

    To create or edit ntconfig.pol you must use - the NT Server Policy Editor, poledit.exe which - is included with NT Server but not NT Workstation. - There is a Policy Editor on a NTws - but it is not suitable for creating Domain Policies. - Further, although the Windows 95 - Policy Editor can be installed on an NT Workstation/Server, it will not - work with NT policies because the registry key that are set by the policy templates. - However, the files from the NT Server will run happily enough on an NTws. - You need poledit.exe, common.adm and winnt.adm. It is convenient - to put the two *.adm files in c:\winnt\inf which is where - the binary will look for them unless told otherwise. Note also that that - directory is 'hidden'. -

    The Windows NT policy editor is also included with the Service Pack 3 (and - later) for Windows NT 4.0. Extract the files using servicepackname /x, - i.e. that's Nt4sp6ai.exe /x for service pack 6a. The policy editor, - poledit.exe and the associated template files (*.adm) should - be extracted as well. It is also possible to downloaded the policy template - files for Office97 and get a copy of the policy editor. Another possible - location is with the Zero Administration Kit available for download from Microsoft. -

  • Can Win95 do Policies? -

    Install the group policy handler for Win9x to pick up group - policies. Look on the Win98 CD in \tools\reskit\netadmin\poledit. - Install group policies on a Win9x client by double-clicking - grouppol.inf. Log off and on again a couple of - times and see if Win98 picks up group policies. Unfortunately this needs - to be done on every Win9x machine that uses group policies.... -

    If group policies don't work one reports suggests getting the updated - (read: working) grouppol.dll for Windows 9x. The group list is grabbed - from /etc/group. -

  • How do I get 'User Manager' and 'Server Manager' -

    Since I don't need to buy an NT Server CD now, how do I get - the 'User Manager for Domains', the 'Server Manager'? -

    Since I don't need to buy an NT Server CD now, how do I get the 'User Manager for Domains', +the 'Server Manager'?

    Microsoft distributes a version of these tools called nexus for - installation on Windows 95 systems. The tools set includes -

    Microsoft distributes a version of these tools called nexus for installation on Windows 95 +systems. The tools set includes:

      Click here to download the archived file Click here to download the archived file ftp://ftp.microsoft.com/Softlib/MSLFILES/NEXUS.EXE -

      The Windows NT 4.0 version of the 'User Manager for - Domains' and 'Server Manager' are available from Microsoft via ftp - from The Windows NT 4.0 version of the 'User Manager for +Domains' and 'Server Manager' are available from Microsoft via ftp +from ftp://ftp.microsoft.com/Softlib/MSLFILES/SRVTOOLS.EXE -



    10.1.1. Creating Group Prolicy Files

    Chapter 11. UNIX Permission Bits and Windows NT Access Control Lists

    10.1.1.1. Windows '9x

    You need the Win98 Group Policy Editor to -set Group Profiles up under Windows '9x. It can be found on the Original -full product Win98 installation CD under -tools/reskit/netadmin/poledit. You install this -using the Add/Remove Programs facility and then click on the 'Have Disk' -tab.

    Use the Group Policy Editor to create a policy file that specifies the -location of user profiles and/or the My Documents etc. -stuff. You then save these settings in a file called -Config.POL that needs to be placed in -the root of the [NETLOGON] share. If your Win98 is configured to log onto -the Samba Domain, it will automatically read this file and update the -Win9x/Me registry of the machine that is logging on.

    11.1. Viewing and changing UNIX permissions using the NT + security dialogs

    All of this is covered in the Win98 Resource Kit documentation.

    Windows NT clients can use their native security settings + dialog box to view and modify the underlying UNIX permissions.

    If you do not do it this way, then every so often Win9x/Me will check the -integrity of the registry and will restore it's settings from the back-up -copy of the registry it stores on each Win9x/Me machine. Hence, you will -occasionally notice things changing back to the original settings.

    Note that this ability is careful not to compromise + the security of the UNIX host Samba is running on, and + still obeys all the file permission rules that a Samba + administrator can set.


    10.2. Roaming Profiles11.2. How to view file security on a Samba share

    From an NT4/2000/XP client, single-click with the right + mouse button on any file or directory in a Samba mounted + drive letter or UNC path. When the menu pops-up, click + on the NOTE!Properties Roaming profiles support is different for Win9X and WinNT.

    entry at the bottom of + the menu. This brings up the file properties dialog + box. Click on the tab Security and you + will see three buttons, Permissions, + Auditing, and Ownership. + The Auditing button will cause either + an error message A requested privilege is not held + by the client to appear if the user is not the + NT Administrator, or a dialog which is intended to allow an + Administrator to add auditing requirements to a file if the + user is logged on as the NT Administrator. This dialog is + non-functional with a Samba share at this time, as the only + useful button, the Add button will not currently + allow a list of users to be seen.

    Before discussing how to configure roaming profiles, it is useful to see how -Win9X and WinNT clients implement these features.

    Win9X clients send a NetUserGetInfo request to the server to get the user's -profiles location. However, the response does not have room for a separate -profiles location field, only the user's home share. This means that Win9X -profiles are restricted to being in the user's home directory.

    WinNT clients send a NetSAMLogon RPC request, which contains many fields, -including a separate field for the location of the user's profiles. -This means that support for profiles is different for Win9X and WinNT.



    10.2.1. Windows NT Configuration

    11.3. Viewing file ownership

    To support WinNT clients, in the [global] section of smb.conf set the -following (for example):

    Clicking on the "Ownership" button + brings up a dialog box telling you who owns the given file. The + owner name will be of the form :

    logon path = \\profileserver\profileshare\profilepath\%U\moreprofilepath
    "SERVER\user (Long name)"

    The default for this option is \\%N\%U\profile, namely -\\sambaserver\username\profile. The \\N%\%U service is created -automatically by the [homes] service. -If you are using a samba server for the profiles, you _must_ make the -share specified in the logon path browseable.

    Where SERVER is the NetBIOS name of + the Samba server, user is the user name of + the UNIX user who owns the file, and (Long name) + is the descriptive string identifying the user (normally found in the + GECOS field of the UNIX password database). Click on the Close + button to remove this dialog.

    If the parameter nt acl support + is set to false then the file owner will + be shown as the NT user "Everyone".

    MS Windows NT/2K clients at times do not disconnect a connection to a server -between logons. It is recommended to NOT use the The Take Ownership button will not allow + you to change the ownership of this file to yourself (clicking on + it will display a dialog box complaining that the user you are + currently logged onto the NT client cannot be found). The reason + for this is that changing the ownership of a file is a privileged + operation in UNIX, available only to the homesroot -meta-service name as part of the profile share path.


    10.2.2. Windows 9X Configuration

    To support Win9X clients, you must use the "logon home" parameter. Samba has -now been fixed so that "net use /home" now works as well, and it, too, relies -on the "logon home" parameter.

    By using the logon home parameter, you are restricted to putting Win9X -profiles in the user's home directory. But wait! There is a trick you -can use. If you set the following in the [global] section of your -smb.conf file:

    logon home = \\%L\%U\.profiles

    then your Win9X clients will dutifully put their clients in a subdirectory -of your home directory called .profiles (thus making them hidden).

    + user. As clicking on this button causes NT to attempt to change + the ownership of a file to the current user logged into the NT + client this will not work with Samba at this time.

    Not only that, but 'net use/home' will also work, because of a feature in -Win9X. It removes any directory stuff off the end of the home directory area -and only uses the server and share portion. That is, it looks like you -specified \\%L\%U for "logon home".

    There is an NT chown command that will work with Samba + and allow a user with Administrator privilege connected + to a Samba server as root to change the ownership of + files on both a local NTFS filesystem or remote mounted NTFS + or Samba drive. This is available as part of the Seclib + NT security library written by Jeremy Allison of + the Samba Team, available from the main Samba ftp site.



    10.2.3. Win9X and WinNT Configuration

    11.4. Viewing file or directory permissions

    You can support profiles for both Win9X and WinNT clients by setting both the -"logon home" and "logon path" parameters. For example:

    The third button is the "Permissions" + button. Clicking on this brings up a dialog box that shows both + the permissions and the UNIX owner of the file or directory. + The owner is displayed in the form :

    logon home = \\%L\%U\.profiles
    -logon path = \\%L\profiles\%U
    "SERVER\user (Long name)"

    Where SERVER is the NetBIOS name of + the Samba server, user is the user name of + the UNIX user who owns the file, and (Long name) + is the descriptive string identifying the user (normally found in the + GECOS field of the UNIX password database).

    I have not checked what 'net use /home' does on NT when "logon home" is -set as above.

    If the parameter nt acl support + is set to false then the file owner will + be shown as the NT user "Everyone" and the + permissions will be shown as NT "Full Control".

    The permissions field is displayed differently for files + and directories, so I'll describe the way file permissions + are displayed first.


    10.2.4. Windows 9X Profile Setup11.4.1. File Permissions

    When a user first logs in on Windows 9X, the file user.DAT is created, -as are folders "Start Menu", "Desktop", "Programs" and "Nethood". -These directories and their contents will be merged with the local -versions stored in c:\windows\profiles\username on subsequent logins, -taking the most recent from each. You will need to use the [global] -options "preserve case = yes", "short preserve case = yes" and -"case sensitive = no" in order to maintain capital letters in shortcuts -in any of the profile folders.

    The user.DAT file contains all the user's preferences. If you wish to -enforce a set of preferences, rename their user.DAT file to user.MAN, -and deny them write access to this file.

    1. On the Windows 95 machine, go to Control Panel | Passwords and - select the User Profiles tab. Select the required level of - roaming preferences. Press OK, but do _not_ allow the computer - to reboot. -

    2. On the Windows 95 machine, go to Control Panel | Network | - Client for Microsoft Networks | Preferences. Select 'Log on to - NT Domain'. Then, ensure that the Primary Logon is 'Client for - Microsoft Networks'. Press OK, and this time allow the computer - to reboot. -

    Under Windows 95, Profiles are downloaded from the Primary Logon. -If you have the Primary Logon as 'Client for Novell Networks', then -the profiles and logon script will be downloaded from your Novell -Server. If you have the Primary Logon as 'Windows Logon', then the -profiles will be loaded from the local machine - a bit against the -concept of roaming profiles, if you ask me.

    You will now find that the Microsoft Networks Login box contains -[user, password, domain] instead of just [user, password]. Type in -the samba server's domain name (or any other domain known to exist, -but bear in mind that the user will be authenticated against this -domain and profiles downloaded from it, if that domain logon server -supports it), user name and user's password.

    Once the user has been successfully validated, the Windows 95 machine -will inform you that 'The user has not logged on before' and asks you -if you wish to save the user's preferences? Select 'yes'.

    Once the Windows 95 client comes up with the desktop, you should be able -to examine the contents of the directory specified in the "logon path" -on the samba server and verify that the "Desktop", "Start Menu", -"Programs" and "Nethood" folders have been created.

    These folders will be cached locally on the client, and updated when -the user logs off (if you haven't made them read-only by then :-). -You will find that if the user creates further folders or short-cuts, -that the client will merge the profile contents downloaded with the -contents of the profile directory already on the local client, taking -the newest folders and short-cuts from each set.

    If you have made the folders / files read-only on the samba server, -then you will get errors from the w95 machine on logon and logout, as -it attempts to merge the local and the remote profile. Basically, if -you have any errors reported by the w95 machine, check the Unix file -permissions and ownership rights on the profile directory contents, -on the samba server.

    If you have problems creating user profiles, you can reset the user's -local desktop cache, as shown below. When this user then next logs in, -they will be told that they are logging in "for the first time".

    1. instead of logging in under the [user, password, domain] dialog, - press escape. -

    2. run the regedit.exe program, and look in: -

      HKEY_LOCAL_MACHINE\Windows\CurrentVersion\ProfileList -

      you will find an entry, for each user, of ProfilePath. Note the - contents of this key (likely to be c:\windows\profiles\username), - then delete the key ProfilePath for the required user. -

      [Exit the registry editor]. -

    3. WARNING - before deleting the contents of the - directory listed in - the ProfilePath (this is likely to be c:\windows\profiles\username), - ask them if they have any important files stored on their desktop - or in their start menu. delete the contents of the directory - ProfilePath (making a backup if any of the files are needed). -

      This will have the effect of removing the local (read-only hidden - system file) user.DAT in their profile directory, as well as the - local "desktop", "nethood", "start menu" and "programs" folders. -

    4. search for the user's .PWL password-caching file in the c:\windows - directory, and delete it. -

    5. log off the windows 95 client. -

    6. check the contents of the profile path (see "logon path" described - above), and delete the user.DAT or user.MAN file for the user, - making a backup if required. -

    The standard UNIX user/group/world triple and + the corresponding "read", "write", "execute" permissions + triples are mapped by Samba into a three element NT ACL + with the 'r', 'w', and 'x' bits mapped into the corresponding + NT permissions. The UNIX world permissions are mapped into + the global NT group Everyone, followed + by the list of permissions allowed for UNIX world. The UNIX + owner and group permissions are displayed as an NT + user icon and an NT local + group icon respectively followed by the list + of permissions allowed for the UNIX user and group.

    If all else fails, increase samba's debug log levels to between 3 and 10, -and / or run a packet trace program such as tcpdump or netmon.exe, and -look for any error reports.

    As many UNIX permission sets don't map into common + NT names such as "read", "change" or "full control" then + usually the permissions will be prefixed by the words "Special Access" in the NT display list.

    If you have access to an NT server, then first set up roaming profiles -and / or netlogons on the NT server. Make a packet trace, or examine -the example packet traces provided with NT server, and see what the -differences are with the equivalent samba trace.

    But what happens if the file has no permissions allowed + for a particular UNIX user group or world component ? In order + to allow "no permissions" to be seen and modified then Samba + overloads the NT "Take Ownership" ACL attribute + (which has no meaning in UNIX) and reports a component with + no permissions as having the NT "O" bit set. + This was chosen of course to make it look like a zero, meaning + zero permissions. More details on the decision behind this will + be given below.


    10.2.5. Windows NT Workstation 4.011.4.2. Directory Permissions

    When a user first logs in to a Windows NT Workstation, the profile -NTuser.DAT is created. The profile location can be now specified -through the "logon path" parameter.

    There is a parameter that is now available for use with NT Profiles: -"logon drive". This should be set to "h:" or any other drive, and -should be used in conjunction with the new "logon home" parameter.

    The entry for the NT 4.0 profile is a _directory_ not a file. The NT -help on profiles mentions that a directory is also created with a .PDS -extension. The user, while logging in, must have write permission to -create the full profile path (and the folder with the .PDS extension -for those situations where it might be created.)

    Directories on an NT NTFS file system have two + different sets of permissions. The first set of permissions + is the ACL set on the directory itself, this is usually displayed + in the first set of parentheses in the normal "RW" + NT style. This first set of permissions is created by Samba in + exactly the same way as normal file permissions are, described + above, and is displayed in the same way.

    In the profile directory, NT creates more folders than 95. It creates -"Application Data" and others, as well as "Desktop", "Nethood", -"Start Menu" and "Programs". The profile itself is stored in a file -NTuser.DAT. Nothing appears to be stored in the .PDS directory, and -its purpose is currently unknown.

    The second set of directory permissions has no real meaning + in the UNIX permissions world and represents the "inherited" permissions that any file created within + this directory would inherit.

    You can use the System Control Panel to copy a local profile onto -a samba server (see NT Help on profiles: it is also capable of firing -up the correct location in the System Control Panel for you). The -NT Help file also mentions that renaming NTuser.DAT to NTuser.MAN -turns a profile into a mandatory one.

    The case of the profile is significant. The file must be called -NTuser.DAT or, for a mandatory profile, NTuser.MAN.

    Samba synthesises these inherited permissions for NT by + returning as an NT ACL the UNIX permission mode that a new file + created by Samba on this share would receive.


    10.2.6. Windows NT/200x Server

    There is nothing to stop you specifying any path that you like for the -location of users' profiles. Therefore, you could specify that the -profile be stored on a samba server, or any other SMB server, as long as -that SMB server supports encrypted passwords.



    10.2.7. Sharing Profiles between W9x/Me and NT4/200x/XP workstations

    11.5. Modifying file or directory permissions

    Sharing of desktop profiles between Windows versions is NOT recommended. -Desktop profiles are an evolving phenomenon and profiles for later versions -of MS Windows clients add features that may interfere with earlier versions -of MS Windows clients. Probably the more salient reason to NOT mix profiles -is that when logging off an earlier version of MS Windows the older format -of profile contents may overwrite information that belongs to the newer -version resulting in loss of profile information content when that user logs -on again with the newer version of MS Windows.

    Modifying file and directory permissions is as simple + as changing the displayed permissions in the dialog box, and + clicking the OK button. However, there are + limitations that a user needs to be aware of, and also interactions + with the standard Samba permission masks and mapping of DOS + attributes that need to also be taken into account.

    If you then want to share the same Start Menu / Desktop with W9x/Me, you will -need to specify a common location for the profiles. The smb.conf parameters -that need to be common are logon path and -logon homeIf the parameter nt acl support + is set to false then any attempt to set + security permissions will fail with an "Access Denied" + message.

    The first thing to note is that the "Add" + button will not return a list of users in Samba (it will give + an error message of "The remote procedure call failed + and did not execute"). This means that you can only + manipulate the current user/group/world permissions listed in + the dialog box. This actually works quite well as these are the + only permissions that UNIX actually has.

    If a permission triple (either user, group, or world) + is removed from the list of permissions in the NT dialog box, + then when the "OK" button is pressed it will + be applied as "no permissions" on the UNIX side. If you then + view the permissions again the "no permissions" entry will appear + as the NT "O" flag, as described above. This + allows you to add permissions back to a file or directory once + you have removed them from a triple component.

    As UNIX supports only the "r", "w" and "x" bits of + an NT ACL then if other NT security attributes such as "Delete + access" are selected then they will be ignored when applied on + the Samba server.

    When setting permissions on a directory the second + set of permissions (in the second set of parentheses) is + by default applied to all files within that directory. If this + is not what you want you must uncheck the "Replace + permissions on existing files" checkbox in the NT + dialog before clicking "OK".

    If you have this set up correctly, you will find separate user.DAT and -NTuser.DAT files in the same profile directory.

    If you wish to remove all permissions from a + user/group/world component then you may either highlight the + component and click the "Remove" button, + or set the component to only have the special "Take + Ownership" permission (displayed as "O" + ) highlighted.



    10.2.8. Windows NT 4

    Unfortunately, the Resource Kit info is Win NT4 or 200x specific.

    11.6. Interaction with the standard Samba create mask + parameters

    Here is a quick guide:

    There are four parameters + to control interaction with the standard Samba create mask parameters. + These are :

    security mask

    • On your NT4 Domain Controller, right click on 'My Computer', then -select the tab labelled 'User Profiles'.

    • Select a user profile you want to migrate and click on it.

      force security mode

      I am using the term "migrate" lossely. You can copy a profile to -create a group profile. You can give the user 'Everyone' rights to the -profile you copy this to. That is what you need to do, since your samba -domain is not a member of a trust relationship with your NT4 PDC.

    • Click the 'Copy To' button.

    • In the box labelled 'Copy Profile to' add your new path, eg: -c:\temp\foobardirectory security mask

    • Click on the button labelled 'Change' in the "Permitted to use" box.

    • force directory security mode

      Click on the group 'Everyone' and then click OK. This closes the -'chose user' box.

    • Once a user clicks "OK" to apply the + permissions Samba maps the given permissions into a user/group/world + r/w/x triple set, and then will check the changed permissions for a + file against the bits set in the + security mask parameter. Any bits that + were changed that are not set to '1' in this parameter are left alone + in the file permissions.

      Now click OK.

    Essentially, zero bits in the security mask + mask may be treated as a set of bits the user is not + allowed to change, and one bits are those the user is allowed to change. +

    Follow the above for every profile you need to migrate.


    10.2.8.1. Side bar Notes

    If not set explicitly this parameter is set to the same value as + the create mask + parameter. To allow a user to modify all the + user/group/world permissions on a file, set this parameter + to 0777.

    You should obtain the SID of your NT4 domain. You can use smbpasswd to do -this. Read the man page.

    Next Samba checks the changed permissions for a file against + the bits set in the force security mode parameter. Any bits + that were changed that correspond to bits set to '1' in this parameter + are forced to be set.

    With Samba-3.0.0 alpha code you can import all you NT4 domain accounts -using the net samsync method. This way you can retain your profile -settings as well as all your users.


    10.2.8.2. Mandatory profiles

    Essentially, bits set in the force security mode + parameter may be treated as a set of bits that, when + modifying security on a file, the user has always set to be 'on'.

    The above method can be used to create mandatory profiles also. To convert -a group profile into a mandatory profile simply locate the NTUser.DAT file -in the copied profile and rename it to NTUser.MAN.


    10.2.8.3. moveuser.exe

    If not set explicitly this parameter is set to the same value + as the force + create mode parameter. + To allow a user to modify all the user/group/world permissions on a file + with no restrictions set this parameter to 000.

    The W2K professional resource kit has moveuser.exe. moveuser.exe changes -the security of a profile from one user to another. This allows the account -domain to change, and/or the user name to change.

    The security mask and force + security mode parameters are applied to the change + request in that order.

    For a directory Samba will perform the same operations as + described above for a file except using the parameter directory security mask instead of security + mask, and force directory security mode + parameter instead of force security mode + .

    The directory security mask parameter + by default is set to the same value as the directory mask + parameter and the force directory security + mode parameter by default is set to the same value as + the force directory mode parameter.

    In this way Samba enforces the permission restrictions that + an administrator can set on a Samba share, whilst still allowing users + to modify the permission bits within that restriction.

    If you want to set up a share that allows users full control + in modifying the permission bits on their files and directories and + doesn't force any particular bits to be set 'on', then set the following + parameters in the smb.conf(5) + file in that share specific section :

    security mask = 0777

    force security mode = 0

    directory security mask = 0777

    force directory security mode = 0



    10.2.8.4. Get SID

    11.7. Interaction with the standard Samba file attribute + mapping

    You can identify the SID by using GetSID.exe from the Windows NT Server 4.0 -Resource Kit.

    Samba maps some of the DOS attribute bits (such as "read + only") into the UNIX permissions of a file. This means there can + be a conflict between the permission bits set via the security + dialog and the permission bits set by the file attribute mapping. +

    Windows NT 4.0 stores the local profile information in the registry under -the following key: -HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

    One way this can show up is if a file has no UNIX read access + for the owner it will show up as "read only" in the standard + file attributes tabbed dialog. Unfortunately this dialog is + the same one that contains the security info in another tab.

    Under the ProfileList key, there will be subkeys named with the SIDs of the -users who have logged on to this computer. (To find the profile information -for the user whose locally cached profile you want to move, find the SID for -the user with the GetSID.exe utility.) Inside of the appropriate user's -subkey, you will see a string value named ProfileImagePath.

    What this can mean is that if the owner changes the permissions + to allow themselves read access using the security dialog, clicks + "OK" to get back to the standard attributes tab + dialog, and then clicks "OK" on that dialog, then + NT will set the file permissions back to read-only (as that is what + the attributes still say in the dialog). This means that after setting + permissions and clicking "OK" to get back to the + attributes dialog you should always hit "Cancel" + rather than "OK" to ensure that your changes + are not overridden.



    10.2.9. Windows 2000/XP

    Chapter 12. Group mapping HOWTO

    You must first convert the profile from a local profile to a domain -profile on the MS Windows workstation as follows:

    +Starting with Samba 3.0 alpha 2, a new group mapping function is available. The +current method (likely to change) to manage the groups is a new command called +smbgroupedit.

    • The first immediate reason to use the group mapping on a PDC, is that +the domain admin group of smb.conf is +now gone. This parameter was used to give the listed users local admin rights +on their workstations. It was some magic stuff that simply worked but didn't +scale very well for complex setups.

      Log on as the LOCAL workstation administrator.

    • Let me explain how it works on NT/W2K, to have this magic fade away. +When installing NT/W2K on a computer, the installer program creates some users +and groups. Notably the 'Administrators' group, and gives to that group some +privileges like the ability to change the date and time or to kill any process +(or close too) running on the local machine. The 'Administrator' user is a +member of the 'Administrators' group, and thus 'inherit' the 'Administrators' +group privileges. If a 'joe' user is created and become a member of the +'Administrator' group, 'joe' has exactly the same rights as 'Administrator'.

      Right click on the 'My Computer' Icon, select 'Properties'

    • When a NT/W2K machine is joined to a domain, during that phase, the "Domain +Administrators' group of the PDC is added to the 'Administrators' group of the +workstation. Every members of the 'Domain Administrators' group 'inherit' the +rights of the 'Administrators' group when logging on the workstation.

      Click on the 'User Profiles' tab

    • You are now wondering how to make some of your samba PDC users members of the +'Domain Administrators' ? That's really easy.

      Select the profile you wish to convert (click on it once)

      1. Click on the button 'Copy To'

        create a unix group (usually in /etc/group), let's call it domadm

      2. In the "Permitted to use" box, click on the 'Change' button.

        add to this group the users that must be Administrators. For example if you want joe,john and mary, your entry in /etc/group will look like:

        domadm:x:502:joe,john,mary

      3. Click on the 'Look in" area that lists the machine name, when you click -here it will open up a selection box. Click on the domain to which the -profile must be accessible.

        Map this domadm group to the domain admins group by running the command:

        smbgroupedit -c "Domain Admins" -u domadm

        You will need to log on if a logon box opens up. Eg: In the connect -as: MIDEARTH\root, password: mypassword.

      To make the profile capable of being used by anyone select 'Everyone'

    • You're set, joe, john and mary are domain administrators !

      Click OK. The Selection box will close.

    • Like the Domain Admins group, you can map any arbitrary Unix group to any NT +group. You can also make any Unix group a domain group. For example, on a domain +member machine (an NT/W2K or a samba server running winbind), you would like to +give access to a certain directory to some users who are member of a group on +your samba PDC. Flag that group as a domain group by running:

      Now click on the 'Ok' button to create the profile in the path you -nominated.

    smbgroupedit -a unixgroup -td

    Done. You now have a profile that can be editted using the samba-3.0.0 -profiles tool.

    You can list the various groups in the mapping database like this

    smbgroupedit -v


    Chapter 13. Configuring PAM for distributed but centrally +managed authentication

    13.1. Samba and PAM

    A number of Unix systems (eg: Sun Solaris), as well as the +xxxxBSD family and Linux, now utilize the Pluggable Authentication +Modules (PAM) facility to provide all authentication, +authorization and resource control services. Prior to the +introduction of PAM, a decision to use an alternative to +the system password database (/etc/passwd) +would require the provision of alternatives for all programs that provide +security services. Such a choice would involve provision of +alternatives to such programs as: login, +passwd, chown, etc.

    PAM provides a mechanism that disconnects these security programs +from the underlying authentication/authorization infrastructure. +PAM is configured either through one file /etc/pam.conf (Solaris), +or by editing individual files that are located in /etc/pam.d.

    Under NT/2K the use of mandotory profiles forces the use of MS Exchange -storage of mail data. That keeps desktop profiles usable.

    If the PAM authentication module (loadable link library file) is located in the + default location then it is not necessary to specify the path. In the case of + Linux, the default location is /lib/security. If the module + is located other than default then the path may be specified as: + +
    	eg: "auth       required      /other_path/pam_strange_module.so"
    +	
    +

    NOTE: editing in the "mime.convs" and the "mime.types" file does not *enforce* -"raw" printing, it only *allows* it.

    Till Kamppeter from MandrakeSoft is doing an excellent job here that too few +people are aware of. (So if you use it often, please send him a note showing +your appreciation).

    The following is an example /etc/pam.d/login configuration file. +This example had all options been uncommented is probably not usable +as it stacks many conditions before allowing successful completion +of the login process. Essentially all conditions can be disabled +by commenting them out except the calls to pam_pwdb.so.

    	#%PAM-1.0
    +	# The PAM configuration file for the `login' service
    +	#
    +	auth 		required	pam_securetty.so
    +	auth 		required	pam_nologin.so
    +	# auth 		required	pam_dialup.so
    +	# auth 		optional	pam_mail.so
    +	auth		required	pam_pwdb.so shadow md5
    +	# account    	requisite  	pam_time.so
    +	account		required	pam_pwdb.so
    +	session		required	pam_pwdb.so
    +	# session 	optional	pam_lastlog.so
    +	# password   	required   	pam_cracklib.so retry=3
    +	password	required	pam_pwdb.so shadow md5

    • This is a security check new to Windows XP (or maybe only -Windows XP service pack 1). It can be disabled via a group policy in -Active Directory. The policy is:

      "Computer Configuration\Administrative Templates\System\User -Profiles\Do not check for user ownership of Roaming Profile Folders"

      ...and it should be set to "Enabled". -Does the new version of samba have an Active Directory analogue? If so, -then you may be able to set the policy through this.

      If you cannot set group policies in samba, then you may be able to set -the policy locally on each machine. If you want to try this, then do -the following (N.B. I don't know for sure that this will work in the -same way as a domain group policy):

    • On the XP workstation log in with an Administrator account.

    • Click: "Start", "Run"

    • Type: "mmc"

    • Click: "OK"

    • PAM allows use of replacable modules. Those available on a +sample system include:

      A Microsoft Management Console should appear.

    • 	$ /bin/ls /lib/security
      +	pam_access.so    pam_ftp.so          pam_limits.so     
      +	pam_ncp_auth.so  pam_rhosts_auth.so  pam_stress.so     
      +	pam_cracklib.so  pam_group.so        pam_listfile.so   
      +	pam_nologin.so   pam_rootok.so       pam_tally.so      
      +	pam_deny.so      pam_issue.so        pam_mail.so       
      +	pam_permit.so    pam_securetty.so    pam_time.so       
      +	pam_dialup.so    pam_lastlog.so      pam_mkhomedir.so  
      +	pam_pwdb.so      pam_shells.so       pam_unix.so       
      +	pam_env.so       pam_ldap.so         pam_motd.so       
      +	pam_radius.so    pam_smbpass.so      pam_unix_acct.so  
      +	pam_wheel.so     pam_unix_auth.so    pam_unix_passwd.so
      +	pam_userdb.so    pam_warn.so         pam_unix_session.so

      Click: File, "Add/Remove Snap-in...", "Add"

    • Double-Click: "Group Policy"

    • Click: "Finish", "Close"

    • Click: "OK"

    • In the "Console Root" window:

    • Expand: "Local Computer Policy", "Computer Configuration",

    • The following example for the login program replaces the use of +the pam_pwdb.so module which uses the system +password database (/etc/passwd, +/etc/shadow, /etc/group) with +the module pam_smbpass.so which uses the Samba +database which contains the Microsoft MD4 encrypted password +hashes. This database is stored in either +/usr/local/samba/private/smbpasswd, +/etc/samba/smbpasswd, or in +/etc/samba.d/smbpasswd, depending on the +Samba implementation for your Unix/Linux system. The +pam_smbpass.so module is provided by +Samba version 2.2.1 or later. It can be compiled by specifying the +--with-pam_smbpass options when running Samba's +configure script. For more information +on the pam_smbpass module, see the documentation +in the source/pam_smbpass directory of the Samba +source distribution.

      "Administrative Templates", "System", "User Profiles"

    • 	#%PAM-1.0
      +	# The PAM configuration file for the `login' service
      +	#
      +	auth		required	pam_smbpass.so nodelay
      +	account		required	pam_smbpass.so nodelay
      +	session		required	pam_smbpass.so nodelay
      +	password	required	pam_smbpass.so nodelay

      Double-Click: "Do not check for user ownership of Roaming Profile

    • The following is the PAM configuration file for a particular +Linux system. The default condition uses pam_pwdb.so.

      Folders"

    • 	#%PAM-1.0
      +	# The PAM configuration file for the `samba' service
      +	#
      +	auth       required     /lib/security/pam_pwdb.so nullok nodelay shadow audit
      +	account    required     /lib/security/pam_pwdb.so audit nodelay
      +	session    required     /lib/security/pam_pwdb.so nodelay
      +	password   required     /lib/security/pam_pwdb.so shadow md5

      Select: "Enabled"

    • In the following example the decision has been made to use the +smbpasswd database even for basic samba authentication. Such a +decision could also be made for the passwd program and would +thus allow the smbpasswd passwords to be changed using the passwd +program.

      Click: OK"

    • 	#%PAM-1.0
      +	# The PAM configuration file for the `samba' service
      +	#
      +	auth       required     /lib/security/pam_smbpass.so nodelay
      +	account    required     /lib/security/pam_pwdb.so audit nodelay
      +	session    required     /lib/security/pam_pwdb.so nodelay
      +	password   required     /lib/security/pam_smbpass.so nodelay smbconf=/etc/samba.d/smb.conf

      Close the whole console. You do not need to save the settings (this -refers to the console settings rather than the policies you have -changed).

    • Reboot

      PAM allows stacking of authentication mechanisms. It is +also possible to pass information obtained within one PAM module through +to the next module in the PAM stack. Please refer to the documentation for +your particular system implementation for details regarding the specific +capabilities of PAM in this environment. Some Linux implmentations also +provide the pam_stack.so module that allows all +authentication to be configured in a single central file. The +pam_stack.so method has some very devoted followers +on the basis that it allows for easier administration. As with all issues in +life though, every decision makes trade-offs, so you may want examine the +PAM documentation for further helpful information.


      13.2. Distributed Authentication

      The astute administrator will realize from this that the +combination of pam_smbpass.so, +winbindd, and a distributed +passdb backend, such as ldap, will allow the establishment of a +centrally managed, distributed +user/password database that can also be used by all +PAM (eg: Linux) aware programs and applications. This arrangement +can have particularly potent advantages compared with the +use of Microsoft Active Directory Service (ADS) in so far as +reduction of wide area network authentication traffic.


      13.3. PAM Configuration in smb.conf

      There is an option in smb.conf called obey pam restrictions. +The following is from the on-line help for this option in SWAT;

      When Samba is configured to enable PAM support (i.e. +--with-pam), this parameter will +control whether or not Samba should obey PAM's account +and session management directives. The default behavior +is to use PAM for clear text authentication only and to +ignore any account or session management. Note that Samba always +ignores PAM for authentication in the case of +encrypt passwords = yes. +The reason is that PAM modules cannot support the challenge/response +authentication mechanism needed in the presence of SMB +password encryption.

      Default: obey pam restrictions = no


      Chapter 11. UNIX Permission Bits and Windows NT Access Control Lists

      Chapter 14. Printing Support

      11.1. Viewing and changing UNIX permissions using the NT - security dialogs14.1. Introduction

      Windows NT clients can use their native security settings - dialog box to view and modify the underlying UNIX permissions.

      Beginning with the 2.2.0 release, Samba supports +the native Windows NT printing mechanisms implemented via +MS-RPC (i.e. the SPOOLSS named pipe). Previous versions of +Samba only supported LanMan printing calls.

      Note that this ability is careful not to compromise - the security of the UNIX host Samba is running on, and - still obeys all the file permission rules that a Samba - administrator can set.


      11.2. How to view file security on a Samba share

      From an NT4/2000/XP client, single-click with the right - mouse button on any file or directory in a Samba mounted - drive letter or UNC path. When the menu pops-up, click - on the Properties entry at the bottom of - the menu. This brings up the file properties dialog - box. Click on the tab Security and you - will see three buttons, Permissions, - Auditing, and Ownership. - The Auditing button will cause either - an error message A requested privilege is not held - by the client to appear if the user is not the - NT Administrator, or a dialog which is intended to allow an - Administrator to add auditing requirements to a file if the - user is logged on as the NT Administrator. This dialog is - non-functional with a Samba share at this time, as the only - useful button, the Add button will not currently - allow a list of users to be seen.


      11.3. Viewing file ownership

      Clicking on the "Ownership" button - brings up a dialog box telling you who owns the given file. The - owner name will be of the form :

      The additional functionality provided by the new +SPOOLSS support includes:

      "SERVER\user (Long name)"

      • Where SERVER is the NetBIOS name of - the Samba server, user is the user name of - the UNIX user who owns the file, and (Long name) - is the descriptive string identifying the user (normally found in the - GECOS field of the UNIX password database). Click on the Close - button to remove this dialog.

        Support for downloading printer driver + files to Windows 95/98/NT/2000 clients upon demand. +

      • If the parameter nt acl support - is set to false then the file owner will - be shown as the NT user "Everyone".

        Uploading of printer drivers via the + Windows NT Add Printer Wizard (APW) or the + Imprints tool set (refer to http://imprints.sourceforge.net). +

      • The Take Ownership button will not allow - you to change the ownership of this file to yourself (clicking on - it will display a dialog box complaining that the user you are - currently logged onto the NT client cannot be found). The reason - for this is that changing the ownership of a file is a privileged - operation in UNIX, available only to the rootSupport for the native MS-RPC printing + calls such as StartDocPrinter, EnumJobs(), etc... (See + the MSDN documentation at http://msdn.microsoft.com/ - user. As clicking on this button causes NT to attempt to change - the ownership of a file to the current user logged into the NT - client this will not work with Samba at this time.

      • There is an NT chown command that will work with Samba - and allow a user with Administrator privilege connected - to a Samba server as root to change the ownership of - files on both a local NTFS filesystem or remote mounted NTFS - or Samba drive. This is available as part of the Support for NT Access Control Lists (ACL) + on printer objects

      • Improved support for printer queue manipulation + through the use of an internal databases for spooled job + information

      There has been some initial confusion about what all this means +and whether or not it is a requirement for printer drivers to be +installed on a Samba host in order to support printing from Windows +clients. As a side note, Samba does not use these drivers in any way to process +spooled files. They are utilized entirely by the clients.

      The following MS KB article, may be of some help if you are dealing with +Windows 2000 clients: Seclib - How to Add Printers with No User +Interaction in Windows 2000 NT security library written by Jeremy Allison of - the Samba Team, available from the main Samba ftp site.

      http://support.microsoft.com/support/kb/articles/Q189/1/05.ASP


      11.4. Viewing file or directory permissions14.2. Configuration

      The third button is the "Permissions" - button. Clicking on this brings up a dialog box that shows both - the permissions and the UNIX owner of the file or directory. - The owner is displayed in the form :

      "SERVER\user (Long name)"

      [print$] vs. [printer$]
       

      Where SERVER is the NetBIOS name of - the Samba server, user is the user name of - the UNIX user who owns the file, and (Long name) - is the descriptive string identifying the user (normally found in the - GECOS field of the UNIX password database).

      Previous versions of Samba recommended using a share named [printer$]. +This name was taken from the printer$ service created by Windows 9x +clients when a printer was shared. Windows 9x printer servers always have +a printer$ service which provides read-only access via no +password in order to support printer driver downloads.

      If the parameter However, the initial implementation allowed for a +parameter named nt acl support - is set to false then the file owner will - be shown as the NT user "Everyone" and the - permissions will be shown as NT "Full Control".

      The permissions field is displayed differently for files - and directories, so I'll describe the way file permissions - are displayed first.

      printer driver location +to be used on a per share basis to specify the location of +the driver files associated with that printer. Another +parameter named printer driver provided +a means of defining the printer driver name to be sent to +the client.


      11.4.1. File Permissions14.2.1. Creating [print$]

      The standard UNIX user/group/world triple and - the corresponding "read", "write", "execute" permissions - triples are mapped by Samba into a three element NT ACL - with the 'r', 'w', and 'x' bits mapped into the corresponding - NT permissions. The UNIX world permissions are mapped into - the global NT group Everyone, followed - by the list of permissions allowed for UNIX world. The UNIX - owner and group permissions are displayed as an NT - user icon and an NT local - group icon respectively followed by the list - of permissions allowed for the UNIX user and group.

      In order to support the uploading of printer driver +files, you must first configure a file share named [print$]. +The name of this share is hard coded in Samba's internals so +the name is very important (print$ is the service used by +Windows NT print servers to provide support for printer driver +download).

      As many UNIX permission sets don't map into common - NT names such as "read", "change" or "full control" then - usually the permissions will be prefixed by the words "Special Access" in the NT display list.

      You should modify the server's smb.conf file to add the global +parameters and to create the +following file share (of course, some of the parameter values, +such as 'path' are arbitrary and should be replaced with +appropriate values for your site):

      But what happens if the file has no permissions allowed - for a particular UNIX user group or world component ? In order - to allow "no permissions" to be seen and modified then Samba - overloads the NT "Take Ownership" ACL attribute - (which has no meaning in UNIX) and reports a component with - no permissions as having the NT "O" bit set. - This was chosen of course to make it look like a zero, meaning - zero permissions. More details on the decision behind this will - be given below.


      11.4.2. Directory Permissions

      [global]
      +    ; members of the ntadmin group should be able
      +    ; to add drivers and set printer properties
      +    ; root is implicitly a 'printer admin'
      +    printer admin = @ntadmin
      +
      +[print$]
      +    path = /usr/local/samba/printers
      +    guest ok = yes
      +    browseable = yes
      +    read only = yes
      +    ; since this share is configured as read only, then we need
      +    ; a 'write list'.  Check the file system permissions to make
      +    ; sure this account can copy files to the share.  If this
      +    ; is setup to a non-root account, then it should also exist
      +    ; as a 'printer admin'
      +    write list = @ntadmin,root

      Directories on an NT NTFS file system have two - different sets of permissions. The first set of permissions - is the ACL set on the directory itself, this is usually displayed - in the first set of parentheses in the normal "RW" - NT style. This first set of permissions is created by Samba in - exactly the same way as normal file permissions are, described - above, and is displayed in the same way.

      The write list is used to allow administrative +level user accounts to have write access in order to update files +on the share. See the smb.conf(5) +man page for more information on configuring file shares.

      The second set of directory permissions has no real meaning - in the UNIX permissions world and represents the The requirement for "inherited" permissions that any file created within - this directory would inherit.

      Samba synthesises these inherited permissions for NT by - returning as an NT ACL the UNIX permission mode that a new file - created by Samba on this share would receive.

      guest +ok = yes depends upon how your +site is configured. If users will be guaranteed to have +an account on the Samba host, then this is a non-issue.


      11.5. Modifying file or directory permissions

      Modifying file and directory permissions is as simple - as changing the displayed permissions in the dialog box, and - clicking the OK button. However, there are - limitations that a user needs to be aware of, and also interactions - with the standard Samba permission masks and mapping of DOS - attributes that need to also be taken into account.

      Author's Note
       

      If the parameter nt acl support - is set to false then any attempt to set - security permissions will fail with an The non-issue is that if all your Windows NT users are guaranteed to be +authenticated by the Samba server (such as a domain member server and the NT +user has already been validated by the Domain Controller in +order to logon to the Windows NT console), then guest access +is not necessary. Of course, in a workgroup environment where +you just want to be able to print without worrying about +silly accounts and security, then configure the share for +guest access. You'll probably want to add "Access Denied" - message.

      map to guest = Bad User in the [global] section as well. Make sure +you understand what this parameter does before using it +though. --jerry

      The first thing to note is that the "Add" - button will not return a list of users in Samba (it will give - an error message of "The remote procedure call failed - and did not execute"). This means that you can only - manipulate the current user/group/world permissions listed in - the dialog box. This actually works quite well as these are the - only permissions that UNIX actually has.

      If a permission triple (either user, group, or world) - is removed from the list of permissions in the NT dialog box, - then when the "OK" button is pressed it will - be applied as "no permissions" on the UNIX side. If you then - view the permissions again the "no permissions" entry will appear - as the NT "O" flag, as described above. This - allows you to add permissions back to a file or directory once - you have removed them from a triple component.

      As UNIX supports only the "r", "w" and "x" bits of - an NT ACL then if other NT security attributes such as "Delete - access" are selected then they will be ignored when applied on - the Samba server.

      In order for a Windows NT print server to support +the downloading of driver files by multiple client architectures, +it must create subdirectories within the [print$] service +which correspond to each of the supported client architectures. +Samba follows this model as well.

      When setting permissions on a directory the second - set of permissions (in the second set of parentheses) is - by default applied to all files within that directory. If this - is not what you want you must uncheck the "Replace - permissions on existing files" checkbox in the NT - dialog before clicking "OK".

      Next create the directory tree below the [print$] share +for each architecture you wish to support.

      If you wish to remove all permissions from a - user/group/world component then you may either highlight the - component and click the "Remove" button, - or set the component to only have the special "Take - Ownership" permission (displayed as "O" - ) highlighted.

      [print$]-----
      +        |-W32X86           ; "Windows NT x86"
      +        |-WIN40            ; "Windows 95/98"
      +        |-W32ALPHA         ; "Windows NT Alpha_AXP"
      +        |-W32MIPS          ; "Windows NT R4000"
      +        |-W32PPC           ; "Windows NT PowerPC"


      11.6. Interaction with the standard Samba create mask - parameters

      There are four parameters - to control interaction with the standard Samba create mask parameters. - These are :

      security mask

      ATTENTION! REQUIRED PERMISSIONS
       

      force security mode

      In order to currently add a new driver to you Samba host, +one of two conditions must hold true:

      directory security mask

      • force directory security mode

        The account used to connect to the Samba host + must have a uid of 0 (i.e. a root account)

      • Once a user clicks "OK" to apply the - permissions Samba maps the given permissions into a user/group/world - r/w/x triple set, and then will check the changed permissions for a - file against the bits set in the The account used to connect to the Samba host + must be a member of the - security maskprinter + admin parameter. Any bits that - were changed that are not set to '1' in this parameter are left alone - in the file permissions.

        list.

      Essentially, zero bits in the Of course, the connected account must still possess access +to add files to the subdirectories beneath [print$]. Remember +that all file shares are set to 'read only' by default.

      Once you have created the required [print$] service and +associated subdirectories, simply log onto the Samba server using +a root (or security mask - mask may be treated as a set of bits the user is printer admin) account +from a Windows NT 4.0/2k client. Open "Network Neighbourhood" or +"My Network Places" and browse for the Samba host. Once you have located +the server, navigate to the "Printers..." folder. +You should see an initial listing of printers +that matches the printer shares defined on your Samba host.


      14.2.2. Setting Drivers for Existing Printers

      The initial listing of printers in the Samba host's +Printers folder will have no real printer driver assigned +to them. This defaults to a NULL string to allow the use +of the local Add Printer Wizard on NT/2000 clients. +Attempting to view the printer properties for a printer +which has this default driver assigned will result in +the error message:

      notDevice settings cannot be displayed. The driver +for the specified printer is not installed, only spooler +properties will be displayed. Do you want to install the +driver now? - allowed to change, and one bits are those the user is allowed to change. -

      If not set explicitly this parameter is set to the same value as - the create mask - parameter. To allow a user to modify all the - user/group/world permissions on a file, set this parameter - to 0777.

      Next Samba checks the changed permissions for a file against - the bits set in the force security mode parameter. Any bits - that were changed that correspond to bits set to '1' in this parameter - are forced to be set.

      Click "No" in the error dialog and you will be presented with +the printer properties window. The way to assign a driver to a +printer is to either

      Essentially, bits set in the force security mode - parameter may be treated as a set of bits that, when - modifying security on a file, the user has always set to be 'on'.

      • If not set explicitly this parameter is set to the same value - as the force - create mode parameter. - To allow a user to modify all the user/group/world permissions on a file - with no restrictions set this parameter to 000.

        Use the "New Driver..." button to install + a new printer driver, or

      • The security mask and force - security mode parameters are applied to the change - request in that order.

        For a directory Samba will perform the same operations as - described above for a file except using the parameter directory security mask instead of security - mask, and force directory security mode - parameter instead of force security mode - .

        Select a driver from the popup list of + installed drivers. Initially this list will be empty.

      The directory security mask parameter - by default is set to the same value as the directory mask - parameter and the force directory security - mode parameter by default is set to the same value as - the force directory mode parameter.

      If you wish to install printer drivers for client +operating systems other than "Windows NT x86", you will need +to use the "Sharing" tab of the printer properties dialog.

      In this way Samba enforces the permission restrictions that - an administrator can set on a Samba share, whilst still allowing users - to modify the permission bits within that restriction.

      Assuming you have connected with a root account, you +will also be able modify other printer properties such as +ACLs and device settings using this dialog box.

      If you want to set up a share that allows users full control - in modifying the permission bits on their files and directories and - doesn't force any particular bits to be set 'on', then set the following - parameters in the A few closing comments for this section, it is possible +on a Windows NT print server to have printers +listed in the Printers folder which are not shared. Samba does +not make this distinction. By definition, the only printers of +which Samba is aware are those which are specified as shares in +smb.conf(5) - file in that share specific section :

      security mask = 0777

      force security mode = 0

      directory security mask = 0777

      smb.conf.

      force directory security mode = 0

      Another interesting side note is that Windows NT clients do +not use the SMB printer share, but rather can print directly +to any printer on another Windows NT host using MS-RPC. This +of course assumes that the printing client has the necessary +privileges on the remote host serving the printer. The default +permissions assigned by Windows NT to a printer gives the "Print" +permissions to the "Everyone" well-known group.



      11.7. Interaction with the standard Samba file attribute - mapping

      Samba maps some of the DOS attribute bits (such as "read - only") into the UNIX permissions of a file. This means there can - be a conflict between the permission bits set via the security - dialog and the permission bits set by the file attribute mapping. -

      One way this can show up is if a file has no UNIX read access - for the owner it will show up as "read only" in the standard - file attributes tabbed dialog. Unfortunately this dialog is - the same one that contains the security info in another tab.

      14.2.3. Support a large number of printers

      What this can mean is that if the owner changes the permissions - to allow themselves read access using the security dialog, clicks - "OK" to get back to the standard attributes tab - dialog, and then clicks "OK" on that dialog, then - NT will set the file permissions back to read-only (as that is what - the attributes still say in the dialog). This means that after setting - permissions and clicking "OK" to get back to the - attributes dialog you should always hit One issue that has arisen during the development +phase of Samba 2.2 is the need to support driver downloads for +100's of printers. Using the Windows NT APW is somewhat +awkward to say the list. If more than one printer are using the +same driver, the "Cancel"rpcclient's +setdriver command can be used to set the driver +associated with an installed driver. The following is example +of how this could be accomplished:

       
      -	rather than "OK" to ensure that your changes 
      -	are not overridden.

      $ rpcclient pogo -U root%secret -c "enumdrivers" +Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3] + +[Windows NT x86] +Printer Driver Info 1: + Driver Name: [HP LaserJet 4000 Series PS] + +Printer Driver Info 1: + Driver Name: [HP LaserJet 2100 Series PS] + +Printer Driver Info 1: + Driver Name: [HP LaserJet 4Si/4SiMX PS] + +$ rpcclient pogo -U root%secret -c "enumprinters" +Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3] + flags:[0x800000] + name:[\\POGO\hp-print] + description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,] + comment:[] + +$ rpcclient pogo -U root%secret \ +> -c "setdriver hp-print \"HP LaserJet 4000 Series PS\"" +Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3] +Successfully set hp-print to driver HP LaserJet 4000 Series PS.



      Chapter 12. Group mapping HOWTO

      -Starting with Samba 3.0 alpha 2, a new group mapping function is available. The -current method (likely to change) to manage the groups is a new command called -smbgroupedit.

      14.2.4. Adding New Printers via the Windows NT APW

      The first immediate reason to use the group mapping on a PDC, is that -the domain admin group of By default, Samba offers all printer shares defined in smb.conf is -now gone. This parameter was used to give the listed users local admin rights -on their workstations. It was some magic stuff that simply worked but didn't -scale very well for complex setups.

      Let me explain how it works on NT/W2K, to have this magic fade away. -When installing NT/W2K on a computer, the installer program creates some users -and groups. Notably the 'Administrators' group, and gives to that group some -privileges like the ability to change the date and time or to kill any process -(or close too) running on the local machine. The 'Administrator' user is a -member of the 'Administrators' group, and thus 'inherit' the 'Administrators' -group privileges. If a 'joe' user is created and become a member of the -'Administrator' group, 'joe' has exactly the same rights as 'Administrator'.

      When a NT/W2K machine is joined to a domain, during that phase, the "Domain -Administrators' group of the PDC is added to the 'Administrators' group of the -workstation. Every members of the 'Domain Administrators' group 'inherit' the -rights of the 'Administrators' group when logging on the workstation.

      You are now wondering how to make some of your samba PDC users members of the -'Domain Administrators' ? That's really easy.

      +in the "Printers..." folder. Also existing in this folder is the Windows NT +Add Printer Wizard icon. The APW will be show only if

        • create a unix group (usually in /etc/group), let's call it domadm

        • add to this group the users that must be Administrators. For example if you want joe,john and mary, your entry in /etc/group will look like:

          domadm:x:502:joe,john,mary

          The connected user is able to successfully + execute an OpenPrinterEx(\\server) with administrative + privileges (i.e. root or printer admin). +

        • Map this domadm group to the domain admins group by running the command:

          smbgroupedit -c "Domain Admins" -u domadm

          show + add printer wizard = yes (the default). +

      You're set, joe, john and mary are domain administrators !

    Like the Domain Admins group, you can map any arbitrary Unix group to any NT -group. You can also make any Unix group a domain group. For example, on a domain -member machine (an NT/W2K or a samba server running winbind), you would like to -give access to a certain directory to some users who are member of a group on -your samba PDC. Flag that group as a domain group by running:

    In order to be able to use the APW to successfully add a printer to a Samba +server, the add +printer command must have a defined value. The program +hook must successfully add the printer to the system (i.e. +/etc/printcap or appropriate files) and +smb.conf if necessary.

    When using the APW from a client, if the named printer share does +not exist, smbgroupedit -a unixgroup -td

    smbd will execute the add printer +command and reparse to the smb.conf +to attempt to locate the new printer share. If the share is still not defined, +an error of "Access Denied" is returned to the client. Note that the +add printer program is executed under the context +of the connected user, not necessarily a root account.

    You can list the various groups in the mapping database like this

    There is a complementary delete +printer command for removing entries from the "Printers..." +folder.

    smbgroupedit -v

    The following is an example add printer command script. It adds the appropriate entries to /etc/printcap.local (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.

    #!/bin/sh
    +
    +# Script to insert a new printer entry into printcap.local
    +#
    +# $1, printer name, used as the descriptive name
    +# $2, share name, used as the printer name for Linux
    +# $3, port name
    +# $4, driver name
    +# $5, location, used for the device file of the printer
    +# $6, win9x location
    +
    +#
    +# Make sure we use the location that RedHat uses for local printer defs
    +PRINTCAP=/etc/printcap.local
    +DATE=`date +%Y%m%d-%H%M%S`
    +LP=lp
    +RESTART="service lpd restart"
    +
    +# Keep a copy
    +cp $PRINTCAP $PRINTCAP.$DATE
    +# Add the printer to $PRINTCAP
    +echo ""				 			>> $PRINTCAP
    +echo "$2|$1:\\" 					>> $PRINTCAP
    +echo "  :sd=/var/spool/lpd/$2:\\" 			>> $PRINTCAP
    +echo "  :mx=0:ml=0:sh:\\" 				>> $PRINTCAP
    +echo "  :lp=/usr/local/samba/var/print/$5.prn:" 	>> $PRINTCAP
    +
    +touch "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1
    +chown $LP "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1
    +
    +mkdir /var/spool/lpd/$2
    +chmod 700 /var/spool/lpd/$2
    +chown $LP /var/spool/lpd/$2
    +#echo $1 >> "/usr/local/samba/var/print/$5.prn"
    +#echo $2 >> "/usr/local/samba/var/print/$5.prn"
    +#echo $3 >> "/usr/local/samba/var/print/$5.prn"
    +#echo $4 >> "/usr/local/samba/var/print/$5.prn"
    +#echo $5 >> "/usr/local/samba/var/print/$5.prn"
    +#echo $6 >> "/usr/local/samba/var/print/$5.prn"
    +$RESTART >> "/usr/local/samba/var/print/$5.prn"
    +# Not sure if this is needed
    +touch /usr/local/samba/lib/smb.conf
    +#
    +# You need to return a value, but I am not sure what it means.
    +#
    +echo "Done"
    +exit 0


    14.2.5. Samba and Printer Ports

    Windows NT/2000 print servers associate a port with each printer. These normally +take the form of LPT1:, COM1:, FILE:, etc... Samba must also support the +concept of ports associated with a printer. By default, only one printer port, +named "Samba Printer Port", exists on a system. Samba does not really a port in +order to print, rather it is a requirement of Windows clients.

    Note that Samba does not support the concept of "Printer Pooling" internally +either. This is when a logical printer is assigned to multiple ports as +a form of load balancing or fail over.

    If you require that multiple ports be defined for some reason, +smb.conf possesses a enumports +commandChapter 13. Configuring PAM for distributed but centrally -managed authentication which can be used to define an external program +that generates a listing of ports on a system.


    13.1. Samba and PAM14.3. The Imprints Toolset

    A number of Unix systems (eg: Sun Solaris), as well as the -xxxxBSD family and Linux, now utilize the Pluggable Authentication -Modules (PAM) facility to provide all authentication, -authorization and resource control services. Prior to the -introduction of PAM, a decision to use an alternative to -the system password database (/etc/passwd) -would require the provision of alternatives for all programs that provide -security services. Such a choice would involve provision of -alternatives to such programs as: login, -passwd, chown, etc.

    PAM provides a mechanism that disconnects these security programs -from the underlying authentication/authorization infrastructure. -PAM is configured either through one file /etc/pam.conf (Solaris), -or by editing individual files that are located in /etc/pam.d.

    The Imprints tool set provides a UNIX equivalent of the + Windows NT Add Printer Wizard. For complete information, please + refer to the Imprints web site at http://imprints.sourceforge.net/ as well as the documentation + included with the imprints source distribution. This section will + only provide a brief introduction to the features of Imprints.


    14.3.1. What is Imprints?

    Imprints is a collection of tools for supporting the goals + of

    • If the PAM authentication module (loadable link library file) is located in the - default location then it is not necessary to specify the path. In the case of - Linux, the default location is /lib/security. If the module - is located other than default then the path may be specified as: - -

      	eg: "auth       required      /other_path/pam_strange_module.so"
      -	
      -

    Providing a central repository information + regarding Windows NT and 95/98 printer driver packages

  • The following is an example /etc/pam.d/login configuration file. -This example had all options been uncommented is probably not usable -as it stacks many conditions before allowing successful completion -of the login process. Essentially all conditions can be disabled -by commenting them out except the calls to pam_pwdb.so.

    Providing the tools necessary for creating + the Imprints printer driver packages.

  • 	#%PAM-1.0
    -	# The PAM configuration file for the `login' service
    -	#
    -	auth 		required	pam_securetty.so
    -	auth 		required	pam_nologin.so
    -	# auth 		required	pam_dialup.so
    -	# auth 		optional	pam_mail.so
    -	auth		required	pam_pwdb.so shadow md5
    -	# account    	requisite  	pam_time.so
    -	account		required	pam_pwdb.so
    -	session		required	pam_pwdb.so
    -	# session 	optional	pam_lastlog.so
    -	# password   	required   	pam_cracklib.so retry=3
    -	password	required	pam_pwdb.so shadow md5

    Providing an installation client which + will obtain and install printer drivers on remote Samba + and Windows NT 4 print servers.


  • 14.3.2. Creating Printer Driver Packages

    PAM allows use of replacable modules. Those available on a -sample system include:

    The process of creating printer driver packages is beyond + the scope of this document (refer to Imprints.txt also included + with the Samba distribution for more information). In short, + an Imprints driver package is a gzipped tarball containing the + driver files, related INF files, and a control file needed by the + installation client.


    14.3.3. The Imprints server

    	$ /bin/ls /lib/security
    -	pam_access.so    pam_ftp.so          pam_limits.so     
    -	pam_ncp_auth.so  pam_rhosts_auth.so  pam_stress.so     
    -	pam_cracklib.so  pam_group.so        pam_listfile.so   
    -	pam_nologin.so   pam_rootok.so       pam_tally.so      
    -	pam_deny.so      pam_issue.so        pam_mail.so       
    -	pam_permit.so    pam_securetty.so    pam_time.so       
    -	pam_dialup.so    pam_lastlog.so      pam_mkhomedir.so  
    -	pam_pwdb.so      pam_shells.so       pam_unix.so       
    -	pam_env.so       pam_ldap.so         pam_motd.so       
    -	pam_radius.so    pam_smbpass.so      pam_unix_acct.so  
    -	pam_wheel.so     pam_unix_auth.so    pam_unix_passwd.so
    -	pam_userdb.so    pam_warn.so         pam_unix_session.so

    The Imprints server is really a database server that + may be queried via standard HTTP mechanisms. Each printer + entry in the database has an associated URL for the actual + downloading of the package. Each package is digitally signed + via GnuPG which can be used to verify that package downloaded + is actually the one referred in the Imprints database. It is + not recommended that this security check + be disabled.


    14.3.4. The Installation Client

    The following example for the login program replaces the use of -the pam_pwdb.so module which uses the system -password database (/etc/passwd, -/etc/shadow, /etc/group) with -the module pam_smbpass.so which uses the Samba -database which contains the Microsoft MD4 encrypted password -hashes. This database is stored in either -/usr/local/samba/private/smbpasswd, -/etc/samba/smbpasswd, or in -/etc/samba.d/smbpasswd, depending on the -Samba implementation for your Unix/Linux system. The -pam_smbpass.so module is provided by -Samba version 2.2.1 or later. It can be compiled by specifying the ---with-pam_smbpass options when running Samba's -configure script. For more information -on the pam_smbpass module, see the documentation -in the More information regarding the Imprints installation client + is available in the source/pam_smbpass directory of the Samba -source distribution.

    Imprints-Client-HOWTO.ps + file included with the imprints source package.

    The Imprints installation client comes in two forms.

    	#%PAM-1.0
    -	# The PAM configuration file for the `login' service
    -	#
    -	auth		required	pam_smbpass.so nodelay
    -	account		required	pam_smbpass.so nodelay
    -	session		required	pam_smbpass.so nodelay
    -	password	required	pam_smbpass.so nodelay

    • The following is the PAM configuration file for a particular -Linux system. The default condition uses pam_pwdb.soa set of command line Perl scripts

    • a GTK+ based graphical interface to + the command line perl scripts

    The installation client (in both forms) provides a means + of querying the Imprints database server for a matching + list of known printer model names as well as a means to + download and install the drivers on remote Samba and Windows + NT print servers.

    The basic installation process is in four steps and + perl code is wrapped around smbclient + and rpcclient.

    	#%PAM-1.0
    -	# The PAM configuration file for the `samba' service
    -	#
    -	auth       required     /lib/security/pam_pwdb.so nullok nodelay shadow audit
    -	account    required     /lib/security/pam_pwdb.so audit nodelay
    -	session    required     /lib/security/pam_pwdb.so nodelay
    -	password   required     /lib/security/pam_pwdb.so shadow md5
    +foreach (supported architecture for a given driver) +{ + 1. rpcclient: Get the appropriate upload directory + on the remote server + 2. smbclient: Upload the driver files + 3. rpcclient: Issues an AddPrinterDriver() MS-RPC +} + +4. rpcclient: Issue an AddPrinterEx() MS-RPC to actually + create the printer

    In the following example the decision has been made to use the -smbpasswd database even for basic samba authentication. Such a -decision could also be made for the passwd program and would -thus allow the smbpasswd passwords to be changed using the passwd -program.

    One of the problems encountered when implementing + the Imprints tool set was the name space issues between + various supported client architectures. For example, Windows + NT includes a driver named "Apple LaserWriter II NTX v51.8" + and Windows 95 calls its version of this driver "Apple + LaserWriter II NTX"

    	#%PAM-1.0
    -	# The PAM configuration file for the `samba' service
    -	#
    -	auth       required     /lib/security/pam_smbpass.so nodelay
    -	account    required     /lib/security/pam_pwdb.so audit nodelay
    -	session    required     /lib/security/pam_pwdb.so nodelay
    -	password   required     /lib/security/pam_smbpass.so nodelay smbconf=/etc/samba.d/smb.conf

    The problem is how to know what client drivers have + been uploaded for a printer. As astute reader will remember + that the Windows NT Printer Properties dialog only includes + space for one printer driver name. A quick look in the + Windows NT 4.0 system registry at

    HKLM\System\CurrentControlSet\Control\Print\Environment +

    PAM allows stacking of authentication mechanisms. It is -also possible to pass information obtained within one PAM module through -to the next module in the PAM stack. Please refer to the documentation for -your particular system implementation for details regarding the specific -capabilities of PAM in this environment. Some Linux implmentations also -provide the pam_stack.so module that allows all -authentication to be configured in a single central file. The -pam_stack.so method has some very devoted followers -on the basis that it allows for easier administration. As with all issues in -life though, every decision makes trade-offs, so you may want examine the -PAM documentation for further helpful information.

    will reveal that Windows NT always uses the NT driver + name. This is ok as Windows NT always requires that at least + the Windows NT version of the printer driver is present. + However, Samba does not have the requirement internally. + Therefore, how can you use the NT driver name if is has not + already been installed?

    The way of sidestepping this limitation is to require + that all Imprints printer driver packages include both the Intel + Windows NT and 95/98 printer drivers and that NT driver is + installed first.


    13.2. Distributed Authentication14.4. Diagnosis

    The astute administrator will realize from this that the -combination of pam_smbpass.so, -winbindd, and a distributed -passdb backend, such as ldap, will allow the establishment of a -centrally managed, distributed -user/password database that can also be used by all -PAM (eg: Linux) aware programs and applications. This arrangement -can have particularly potent advantages compared with the -use of Microsoft Active Directory Service (ADS) in so far as -reduction of wide area network authentication traffic.


    13.3. PAM Configuration in smb.conf

    There is an option in smb.conf called obey pam restrictions. -The following is from the on-line help for this option in SWAT;

    When Samba is configured to enable PAM support (i.e. ---with-pam), this parameter will -control whether or not Samba should obey PAM's account -and session management directives. The default behavior -is to use PAM for clear text authentication only and to -ignore any account or session management. Note that Samba always -ignores PAM for authentication in the case of -encrypt passwords = yes. -The reason is that PAM modules cannot support the challenge/response -authentication mechanism needed in the presence of SMB -password encryption.

    14.4.1. Introduction

    Default: obey pam restrictions = no


    Chapter 14. Printing Support

    14.1. Introduction

    This is a short description of how to debug printing problems with +Samba. This describes how to debug problems with printing from a SMB +client to a Samba server, not the other way around. For the reverse +see the examples/printing directory.

    Beginning with the 2.2.0 release, Samba supports -the native Windows NT printing mechanisms implemented via -MS-RPC (i.e. the SPOOLSS named pipe). Previous versions of -Samba only supported LanMan printing calls.

    Ok, so you want to print to a Samba server from your PC. The first +thing you need to understand is that Samba does not actually do any +printing itself, it just acts as a middleman between your PC client +and your Unix printing subsystem. Samba receives the file from the PC +then passes the file to a external "print command". What print command +you use is up to you.

    The additional functionality provided by the new -SPOOLSS support includes:

    The whole things is controlled using options in smb.conf. The most +relevant options (which you should look up in the smb.conf man page) +are:

          [global]
    +        print command     - send a file to a spooler
    +        lpq command       - get spool queue status
    +        lprm command      - remove a job
    +      [printers]
    +        path = /var/spool/lpd/samba

    • Support for downloading printer driver - files to Windows 95/98/NT/2000 clients upon demand. -

    • The following are nice to know about:

      Uploading of printer drivers via the - Windows NT Add Printer Wizard (APW) or the - Imprints tool set (refer to http://imprints.sourceforge.net). -

    •         queuepause command   - stop a printer or print queue
      +        queueresume command  - start a printer or print queue

      Support for the native MS-RPC printing - calls such as StartDocPrinter, EnumJobs(), etc... (See - the MSDN documentation at http://msdn.microsoft.com/ - for more information on the Win32 printing API) -

    • Example:

      Support for NT Access Control Lists (ACL) - on printer objects

    •         print command = /usr/bin/lpr -r -P%p %s
      +        lpq command   = /usr/bin/lpq    -P%p %s
      +        lprm command  = /usr/bin/lprm   -P%p %j
      +        queuepause command = /usr/sbin/lpc -P%p stop
      +        queuepause command = /usr/sbin/lpc -P%p start

      Improved support for printer queue manipulation - through the use of an internal databases for spooled job - information

    Samba should set reasonable defaults for these depending on your +system type, but it isn't clairvoyant. It is not uncommon that you +have to tweak these for local conditions. The commands should +always have fully specified pathnames, as the smdb may not have +the correct PATH values.

    There has been some initial confusion about what all this means -and whether or not it is a requirement for printer drivers to be -installed on a Samba host in order to support printing from Windows -clients. As a side note, Samba does not use these drivers in any way to process -spooled files. They are utilized entirely by the clients.

    When you send a job to Samba to be printed, it will make a temporary +copy of it in the directory specified in the [printers] section. +and it should be periodically cleaned out. The lpr -r option +requests that the temporary copy be removed after printing; If +printing fails then you might find leftover files in this directory, +and it should be periodically cleaned out. Samba used the lpq +command to determine the "job number" assigned to your print job +by the spooler.

    The following MS KB article, may be of some help if you are dealing with -Windows 2000 clients: How to Add Printers with No User -Interaction in Windows 2000The %>letter< are "macros" that get dynamically replaced with appropriate +values when they are used. The %s gets replaced with the name of the spool +file that Samba creates and the %p gets replaced with the name of the +printer. The %j gets replaced with the "job number" which comes from +the lpq output.


    14.4.2. Debugging printer problems

    One way to debug printing problems is to start by replacing these +command with shell scripts that record the arguments and the contents +of the print file. A simple example of this kind of things might +be:

    	print command = /tmp/saveprint %p %s
    +
    +    #!/bin/saveprint
    +    # we make sure that we are the right user
    +    /usr/bin/id -p >/tmp/tmp.print
    +    # we run the command and save the error messages
    +    # replace the command with the one appropriate for your system
    +    /usr/bin/lpr -r -P$1 $2 2>>&/tmp/tmp.print

    http://support.microsoft.com/support/kb/articles/Q189/1/05.ASPThen you print a file and try removing it. You may find that the +print queue needs to be stopped in order to see the queue status +and remove the job:

    
h4: {42} % echo hi >/tmp/hi
    +h4: {43} % smbclient //localhost/lw4
    +added interface ip=10.0.0.4 bcast=10.0.0.255 nmask=255.255.255.0
    +Password: 
    +Domain=[ASTART] OS=[Unix] Server=[Samba 2.0.7]
    +smb: \> print /tmp/hi
    +putting file /tmp/hi as hi-17534 (0.0 kb/s) (average 0.0 kb/s)
    +smb: \> queue
    +1049     3            hi-17534
    +smb: \> cancel 1049
    +Error cancelling job 1049 : code 0
    +smb: \> cancel 1049
    +Job 1049 cancelled
    +smb: \> queue
    +smb: \> exit

    The 'code 0' indicates that the job was removed. The comment +by the smbclient is a bit misleading on this. +You can observe the command output and then and look at the +/tmp/tmp.print file to see what the results are. You can quickly +find out if the problem is with your printing system. Often people +have problems with their /etc/printcap file or permissions on +various print queues.



    14.2. Configuration

    14.4.3. What printers do I have?

    You can use the 'testprns' program to check to see if the printer +name you are using is recognized by Samba. For example, you can +use:

        testprns printer /etc/printcap

    [print$] vs. [printer$]
     

    Previous versions of Samba recommended using a share named [printer$]. -This name was taken from the printer$ service created by Windows 9x -clients when a printer was shared. Windows 9x printer servers always have -a printer$ service which provides read-only access via no -password in order to support printer driver downloads.

    Samba can get its printcap information from a file or from a program. +You can try the following to see the format of the extracted +information:

    However, the initial implementation allowed for a -parameter named printer driver location -to be used on a per share basis to specify the location of -the driver files associated with that printer. Another -parameter named printer driver provided -a means of defining the printer driver name to be sent to -the client.

        testprns -a printer /etc/printcap
    +
    +    testprns -a printer '|/bin/cat printcap'


    14.2.1. Creating [print$]14.4.4. Setting up printcap and print servers

    In order to support the uploading of printer driver -files, you must first configure a file share named [print$]. -The name of this share is hard coded in Samba's internals so -the name is very important (print$ is the service used by -Windows NT print servers to provide support for printer driver -download).

    You may need to set up some printcaps for your Samba system to use. +It is strongly recommended that you use the facilities provided by +the print spooler to set up queues and printcap information.

    You should modify the server's smb.conf file to add the global -parameters and to create the -following file share (of course, some of the parameter values, -such as 'path' are arbitrary and should be replaced with -appropriate values for your site):

    Samba requires either a printcap or program to deliver printcap +information. This printcap information has the format:

    [global]
    -    ; members of the ntadmin group should be able
    -    ; to add drivers and set printer properties
    -    ; root is implicitly a 'printer admin'
    -    printer admin = @ntadmin
    -
    -[print$]
    -    path = /usr/local/samba/printers
    -    guest ok = yes
    -    browseable = yes
    -    read only = yes
    -    ; since this share is configured as read only, then we need
    -    ; a 'write list'.  Check the file system permissions to make
    -    ; sure this account can copy files to the share.  If this
    -    ; is setup to a non-root account, then it should also exist
    -    ; as a 'printer admin'
    -    write list = @ntadmin,root
    name|alias1|alias2...:option=value:...

    The write list is used to allow administrative -level user accounts to have write access in order to update files -on the share. See the smb.conf(5) -man page for more information on configuring file shares.

    For almost all printing systems, the printer 'name' must be composed +only of alphanumeric or underscore '_' characters. Some systems also +allow hyphens ('-') as well. An alias is an alternative name for the +printer, and an alias with a space in it is used as a 'comment' +about the printer. The printcap format optionally uses a \ at the end of lines +to extend the printcap to multiple lines.

    Here are some examples of printcap files:

    The requirement for guest -ok = yes depends upon how your -site is configured. If users will be guaranteed to have -an account on the Samba host, then this is a non-issue.

    Author's Note
     
    1. The non-issue is that if all your Windows NT users are guaranteed to be -authenticated by the Samba server (such as a domain member server and the NT -user has already been validated by the Domain Controller in -order to logon to the Windows NT console), then guest access -is not necessary. Of course, in a workgroup environment where -you just want to be able to print without worrying about -silly accounts and security, then configure the share for -guest access. You'll probably want to add map to guest = Bad User in the [global] section as well. Make sure -you understand what this parameter does before using it -though. --jerry

    pr just printer name

  • In order for a Windows NT print server to support -the downloading of driver files by multiple client architectures, -it must create subdirectories within the [print$] service -which correspond to each of the supported client architectures. -Samba follows this model as well.

    pr|alias printer name and alias

  • Next create the directory tree below the [print$] share -for each architecture you wish to support.

    pr|My Printer printer name, alias used as comment

  • [print$]-----
    -        |-W32X86           ; "Windows NT x86"
    -        |-WIN40            ; "Windows 95/98"
    -        |-W32ALPHA         ; "Windows NT Alpha_AXP"
    -        |-W32MIPS          ; "Windows NT R4000"
    -        |-W32PPC           ; "Windows NT PowerPC"

    pr:sh:\ Same as pr:sh:cm= testing + :cm= \ + testing

  • pr:sh Same as pr:sh:cm= testing + :cm= testing

  • ATTENTION! REQUIRED PERMISSIONS
     

    In order to currently add a new driver to you Samba host, -one of two conditions must hold true:

    Samba reads the printcap information when first started. If you make +changes in the printcap information, then you must do the following:

      1. The account used to connect to the Samba host - must have a uid of 0 (i.e. a root account)

        make sure that the print spooler is aware of these changes. +The LPRng system uses the 'lpc reread' command to do this.

      2. The account used to connect to the Samba host - must be a member of the printer - admin list.

        make sure that the spool queues, etc., exist and have the +correct permissions. The LPRng system uses the 'checkpc -f' +command to do this.

    Of course, the connected account must still possess access -to add files to the subdirectories beneath [print$]. Remember -that all file shares are set to 'read only' by default.

  • Once you have created the required [print$] service and -associated subdirectories, simply log onto the Samba server using -a root (or printer admin) account -from a Windows NT 4.0/2k client. Open "Network Neighbourhood" or -"My Network Places" and browse for the Samba host. Once you have located -the server, navigate to the "Printers..." folder. -You should see an initial listing of printers -that matches the printer shares defined on your Samba host.

    You now should send a SIGHUP signal to the smbd server to have +it reread the printcap information.


  • 14.2.2. Setting Drivers for Existing Printers14.4.5. Job sent, no output

    The initial listing of printers in the Samba host's -Printers folder will have no real printer driver assigned -to them. This defaults to a NULL string to allow the use -of the local Add Printer Wizard on NT/2000 clients. -Attempting to view the printer properties for a printer -which has this default driver assigned will result in -the error message:

    This is the most frustrating part of printing. You may have sent the +job, verified that the job was forwarded, set up a wrapper around +the command to send the file, but there was no output from the printer.

    Device settings cannot be displayed. The driver -for the specified printer is not installed, only spooler -properties will be displayed. Do you want to install the -driver now?First, check to make sure that the job REALLY is getting to the +right print queue. If you are using a BSD or LPRng print spooler, +you can temporarily stop the printing of jobs. Jobs can still be +submitted, but they will not be printed. Use:

      lpc -Pprinter stop

    Click "No" in the error dialog and you will be presented with -the printer properties window. The way to assign a driver to a -printer is to either

    Now submit a print job and then use 'lpq -Pprinter' to see if the +job is in the print queue. If it is not in the print queue then +you will have to find out why it is not being accepted for printing.

    Next, you may want to check to see what the format of the job really +was. With the assistance of the system administrator you can view +the submitted jobs files. You may be surprised to find that these +are not in what you would expect to call a printable format. +You can use the UNIX 'file' utitily to determine what the job +format actually is:

        cd /var/spool/lpd/printer   # spool directory of print jobs
    +    ls                          # find job files
    +    file dfA001myhost

    • Use the "New Driver..." button to install - a new printer driver, or

    • You should make sure that your printer supports this format OR that +your system administrator has installed a 'print filter' that will +convert the file to a format appropriate for your printer.


    14.4.6. Job sent, strange output

    Select a driver from the popup list of - installed drivers. Initially this list will be empty.

    Once you have the job printing, you can then start worrying about +making it print nicely.

    If you wish to install printer drivers for client -operating systems other than "Windows NT x86", you will need -to use the "Sharing" tab of the printer properties dialog.

    The most common problem is extra pages of output: banner pages +OR blank pages at the end.

    Assuming you have connected with a root account, you -will also be able modify other printer properties such as -ACLs and device settings using this dialog box.

    If you are getting banner pages, check and make sure that the +printcap option or printer option is configured for no banners. +If you have a printcap, this is the :sh (suppress header or banner +page) option. You should have the following in your printer.

    A few closing comments for this section, it is possible -on a Windows NT print server to have printers -listed in the Printers folder which are not shared. Samba does -not make this distinction. By definition, the only printers of -which Samba is aware are those which are specified as shares in -smb.conf.

       printer: ... :sh

    Another interesting side note is that Windows NT clients do -not use the SMB printer share, but rather can print directly -to any printer on another Windows NT host using MS-RPC. This -of course assumes that the printing client has the necessary -privileges on the remote host serving the printer. The default -permissions assigned by Windows NT to a printer gives the "Print" -permissions to the "Everyone" well-known group.

    If you have this option and are still getting banner pages, there +is a strong chance that your printer is generating them for you +automatically. You should make sure that banner printing is disabled +for the printer. This usually requires using the printer setup software +or procedures supplied by the printer manufacturer.

    If you get an extra page of output, this could be due to problems +with your job format, or if you are generating PostScript jobs, +incorrect setting on your printer driver on the MicroSoft client. +For example, under Win95 there is a option:

      Printers|Printer Name|(Right Click)Properties|Postscript|Advanced|

    that allows you to choose if a Ctrl-D is appended to all jobs. +This is a very bad thing to do, as most spooling systems will +automatically add a ^D to the end of the job if it is detected as +PostScript. The multiple ^D may cause an additional page of output.


    14.2.3. Support a large number of printers14.4.7. Raw PostScript printed

    One issue that has arisen during the development -phase of Samba 2.2 is the need to support driver downloads for -100's of printers. Using the Windows NT APW is somewhat -awkward to say the list. If more than one printer are using the -same driver, the rpcclient's -setdriver command can be used to set the driver -associated with an installed driver. The following is example -of how this could be accomplished:

     
    -$ rpcclient pogo -U root%secret -c "enumdrivers"
    -Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
    - 
    -[Windows NT x86]
    -Printer Driver Info 1:
    -     Driver Name: [HP LaserJet 4000 Series PS]
    - 
    -Printer Driver Info 1:
    -     Driver Name: [HP LaserJet 2100 Series PS]
    - 
    -Printer Driver Info 1:
    -     Driver Name: [HP LaserJet 4Si/4SiMX PS]
    -				  
    -$ rpcclient pogo -U root%secret -c "enumprinters"
    -Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
    -     flags:[0x800000]
    -     name:[\\POGO\hp-print]
    -     description:[POGO\\POGO\hp-print,NO DRIVER AVAILABLE FOR THIS PRINTER,]
    -     comment:[]
    -				  
    -$ rpcclient pogo -U root%secret \
    ->  -c "setdriver hp-print \"HP LaserJet 4000 Series PS\""
    -Domain=[NARNIA] OS=[Unix] Server=[Samba 2.2.0-alpha3]
    -Successfully set hp-print to driver HP LaserJet 4000 Series PS.

    This is a problem that is usually caused by either the print spooling +system putting information at the start of the print job that makes +the printer think the job is a text file, or your printer simply +does not support PostScript. You may need to enable 'Automatic +Format Detection' on your printer.


    14.2.4. Adding New Printers via the Windows NT APW14.4.8. Advanced Printing

    By default, Samba offers all printer shares defined in smb.conf -in the "Printers..." folder. Also existing in this folder is the Windows NT -Add Printer Wizard icon. The APW will be show only if

    • The connected user is able to successfully - execute an OpenPrinterEx(\\server) with administrative - privileges (i.e. root or printer admin). -

    • show - add printer wizard = yes (the default). -

    In order to be able to use the APW to successfully add a printer to a Samba -server, the add -printer command must have a defined value. The program -hook must successfully add the printer to the system (i.e. -/etc/printcap or appropriate files) and -smb.conf if necessary.

    When using the APW from a client, if the named printer share does -not exist, smbd will execute the add printer -command and reparse to the smb.conf -to attempt to locate the new printer share. If the share is still not defined, -an error of "Access Denied" is returned to the client. Note that the -add printer program is executed under the context -of the connected user, not necessarily a root account.

    There is a complementary delete -printer command for removing entries from the "Printers..." -folder.

    The following is an example add printer command script. It adds the appropriate entries to /etc/printcap.local (change that to what you need) and returns a line of 'Done' which is needed for the whole process to work.

    #!/bin/sh
    -
    -# Script to insert a new printer entry into printcap.local
    -#
    -# $1, printer name, used as the descriptive name
    -# $2, share name, used as the printer name for Linux
    -# $3, port name
    -# $4, driver name
    -# $5, location, used for the device file of the printer
    -# $6, win9x location
    -
    -#
    -# Make sure we use the location that RedHat uses for local printer defs
    -PRINTCAP=/etc/printcap.local
    -DATE=`date +%Y%m%d-%H%M%S`
    -LP=lp
    -RESTART="service lpd restart"
    -
    -# Keep a copy
    -cp $PRINTCAP $PRINTCAP.$DATE
    -# Add the printer to $PRINTCAP
    -echo ""				 			>> $PRINTCAP
    -echo "$2|$1:\\" 					>> $PRINTCAP
    -echo "  :sd=/var/spool/lpd/$2:\\" 			>> $PRINTCAP
    -echo "  :mx=0:ml=0:sh:\\" 				>> $PRINTCAP
    -echo "  :lp=/usr/local/samba/var/print/$5.prn:" 	>> $PRINTCAP
    -
    -touch "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1
    -chown $LP "/usr/local/samba/var/print/$5.prn" >> /tmp/printadd.$$ 2>&1
    -
    -mkdir /var/spool/lpd/$2
    -chmod 700 /var/spool/lpd/$2
    -chown $LP /var/spool/lpd/$2
    -#echo $1 >> "/usr/local/samba/var/print/$5.prn"
    -#echo $2 >> "/usr/local/samba/var/print/$5.prn"
    -#echo $3 >> "/usr/local/samba/var/print/$5.prn"
    -#echo $4 >> "/usr/local/samba/var/print/$5.prn"
    -#echo $5 >> "/usr/local/samba/var/print/$5.prn"
    -#echo $6 >> "/usr/local/samba/var/print/$5.prn"
    -$RESTART >> "/usr/local/samba/var/print/$5.prn"
    -# Not sure if this is needed
    -touch /usr/local/samba/lib/smb.conf
    -#
    -# You need to return a value, but I am not sure what it means.
    -#
    -echo "Done"
    -exit 0
    Note that you can do some pretty magic things by using your +imagination with the "print command" option and some shell scripts. +Doing print accounting is easy by passing the %U option to a print +command shell script. You could even make the print command detect +the type of output and its size and send it to an appropriate +printer.


    14.2.5. Samba and Printer Ports14.4.9. Real debugging

    Windows NT/2000 print servers associate a port with each printer. These normally -take the form of LPT1:, COM1:, FILE:, etc... Samba must also support the -concept of ports associated with a printer. By default, only one printer port, -named "Samba Printer Port", exists on a system. Samba does not really a port in -order to print, rather it is a requirement of Windows clients.

    Note that Samba does not support the concept of "Printer Pooling" internally -either. This is when a logical printer is assigned to multiple ports as -a form of load balancing or fail over.

    If you require that multiple ports be defined for some reason, -smb.conf possesses a enumports -command which can be used to define an external program -that generates a listing of ports on a system.

    If the above debug tips don't help, then maybe you need to bring in +the bug guns, system tracing. See Tracing.txt in this directory.


    Chapter 15. CUPS Printing Support


    14.3. The Imprints Toolset15.1. Introduction

    The Imprints tool set provides a UNIX equivalent of the - Windows NT Add Printer Wizard. For complete information, please - refer to the Imprints web site at http://imprints.sourceforge.net/ as well as the documentation - included with the imprints source distribution. This section will - only provide a brief introduction to the features of Imprints.


    14.3.1. What is Imprints?

    The Common Unix Print System (CUPS) has become very popular, but to many it is +a very mystical tool. There is a great deal of uncertainty regarding CUPS and how +it works. The result is seen in a large number of posting on the samba mailing lists +expressing frustration when MS Windows printers appear not to work with a CUPS +backr-end. +/para>

    Imprints is a collection of tools for supporting the goals - of

    This is a good time to point out how CUPS can be used and what it does. CUPS is more +than just a print spooling system - it is a complete printer management system that +complies with HTTP and IPP protocols. It can be managed remotely via a web browser +and it can print using http and ipp protocols.

    CUPS allows to creation of RAW printers (ie: NO file format translation) as well as +SMART printers (ie: CUPS does file format conversion as required for the printer). In +many ways this gives CUPS similar capabilities to the MS Windows print monitoring +system. Of course, if you are a CUPS advocate, you would agrue that CUPS is better! +In any case, let us now move on to explore how one may configure CUPS for interfacing +with MS Windows print clients via Samba.


    15.2. CUPS - RAW Print Through Mode

    When CUPS printers are configured for RAW print-through mode operation it is the +responsibility of the Samba client to fully render the print job (file) in a format +that is suitable for direct delivery to the printer. In this case CUPS will NOT +do any print file format conversion work.

    The CUPS files that need to be correctly set for RAW mode printers to work are: + +

    • Providing a central repository information - regarding Windows NT and 95/98 printer driver packages

    • /etc/cups/mime.types

      Providing the tools necessary for creating - the Imprints printer driver packages.

    • Providing an installation client which - will obtain and install printer drivers on remote Samba - and Windows NT 4 print servers.

      /etc/cups/mime.convs


    14.3.2. Creating Printer Driver Packages

    The process of creating printer driver packages is beyond - the scope of this document (refer to Imprints.txt also included - with the Samba distribution for more information). In short, - an Imprints driver package is a gzipped tarball containing the - driver files, related INF files, and a control file needed by the - installation client.


    14.3.3. The Imprints server

    The Imprints server is really a database server that - may be queried via standard HTTP mechanisms. Each printer - entry in the database has an associated URL for the actual - downloading of the package. Each package is digitally signed - via GnuPG which can be used to verify that package downloaded - is actually the one referred in the Imprints database. It is - + +Both contain entries that must be uncommented to allow notRAW recommended that this security check - be disabled.


    14.3.4. The Installation Client

    More information regarding the Imprints installation client - is available in the Imprints-Client-HOWTO.ps - file included with the imprints source package.

    The Imprints installation client comes in two forms.

    mode +operation.

    Firstly, to enable CUPS based printing from Samba the following options must be +enabled in your smb.conf file [globals] section: + +

    • a set of command line Perl scripts

      printing = CUPS

    • a GTK+ based graphical interface to - the command line perl scripts

      printcap = CUPS

    The installation client (in both forms) provides a means - of querying the Imprints database server for a matching - list of known printer model names as well as a means to - download and install the drivers on remote Samba and Windows - NT print servers.

    The basic installation process is in four steps and - perl code is wrapped around smbclient + +When these parameters are specified the print directives in smb.conf (as well as in +samba itself) will be ignored because samba will directly interface with CUPS through +it's application program interface (API) - so long as Samba has been compiled with +CUPS library (libcups) support. If samba has NOT been compiled with CUPS support then +printing will use the System V AT&T command set with the -oraw - and rpcclient.

    Cupsomatic (an enhanced printing utility that is part of some CUPS implementations) +on the Samba/CUPS server does *not* add any features if a file is really +printed "raw". However, if you have loaded the driver for the Windows client from +the CUPS server, using the "cupsaddsmb" utility, and if this driver is one using +a "Foomatic" PPD, the PJL header in question is already added on the Windows client, +at the time when the driver initially generated the PostScript data and CUPS in true +"-oraw" manner doesn't remove this PJL header and passes the file "as is" to its +printer communication backend.

    	
    -foreach (supported architecture for a given driver)
    -{
    -     1.  rpcclient: Get the appropriate upload directory 
    -         on the remote server
    -     2.  smbclient: Upload the driver files
    -     3.  rpcclient: Issues an AddPrinterDriver() MS-RPC
    -}
    -	
    -4.  rpcclient: Issue an AddPrinterEx() MS-RPC to actually
    -    create the printer

    One of the problems encountered when implementing - the Imprints tool set was the name space issues between - various supported client architectures. For example, Windows - NT includes a driver named "Apple LaserWriter II NTX v51.8" - and Windows 95 calls its version of this driver "Apple - LaserWriter II NTX"

    NOTE: editing in the "mime.convs" and the "mime.types" file does not *enforce* +"raw" printing, it only *allows* it.

    The problem is how to know what client drivers have - been uploaded for a printer. As astute reader will remember - that the Windows NT Printer Properties dialog only includes - space for one printer driver name. A quick look in the - Windows NT 4.0 system registry at

    Print files that arrive from MS Windows printing are "auto-typed" by CUPS. This aids +the process of determining proper treatment while in the print queue system. + +

    • Files generated by PCL drivers and directed at PCK printers get auto-typed as + HKLM\System\CurrentControlSet\Control\Print\Environment - application/octet-stream. Unknown file format types also + get auto-typed with this tag. +

    • Files generated by a Postscript driver and directed at a Postscript printer + are auto-typed depending on the auto-detected most suitable MIME type as: + +

      • will reveal that Windows NT always uses the NT driver - name. This is ok as Windows NT always requires that at least - the Windows NT version of the printer driver is present. - However, Samba does not have the requirement internally. - Therefore, how can you use the NT driver name if is has not - already been installed?

        * application/postscript

      • The way of sidestepping this limitation is to require - that all Imprints printer driver packages include both the Intel - Windows NT and 95/98 printer drivers and that NT driver is - installed first.


    14.4. Diagnosis

    14.4.1. Introduction

    * application/vnd.cups-postscript

    +

    This is a short description of how to debug printing problems with -Samba. This describes how to debug problems with printing from a SMB -client to a Samba server, not the other way around. For the reverse -see the examples/printing directory.

    "application/postscript" first goes thru the "pstops" filter (where the page counting +and accounting takes place). The outcome will be of MIME type +"application/vnd.cups-postscript". The pstopsfilter reads and uses information from +the PPD and inserts user-provided options into the PostScript file. As a consequence, +the filtered file could possibly have an unwanted PJL header.

    Ok, so you want to print to a Samba server from your PC. The first -thing you need to understand is that Samba does not actually do any -printing itself, it just acts as a middleman between your PC client -and your Unix printing subsystem. Samba receives the file from the PC -then passes the file to a external "print command". What print command -you use is up to you.

    "application/postscript" will be all files with a ".ps", ".ai", ".eps" suffix or which +have as their first character string one of "%!" or "<04>%".

    The whole things is controlled using options in smb.conf. The most -relevant options (which you should look up in the smb.conf man page) -are:

    "application/vnd.cups-postscript" will files which contain the string +"LANGUAGE=POSTSCRIPT" (or similar variations with different capitalization) in the +first 512 bytes, and also contain the "PJL super escape code" in the first 128 bytes +("<1B>%-12345X"). Very likely, most PostScript files generated on Windows using a CUPS +or other PPD, will have to be auto-typed as "vnd.cups-postscript". A file produced +with a "Generic PostScript driver" will just be tagged "application/postscript".

    Once the file is in "application/vnd.cups-postscript" format, either "pstoraster" +or "cupsomatic" will take over (depending on the printer configuration, as +determined by the PPD in use).

          [global]
    -        print command     - send a file to a spooler
    -        lpq command       - get spool queue status
    -        lprm command      - remove a job
    -      [printers]
    -        path = /var/spool/lpd/samba

    The following are nice to know about:

    A printer queue with *no* PPD associated to it is a "raw" printer and all files +will go directly there as received by the spooler. The exeptions are file types +"application/octet-stream" which need "passthrough feature" enabled. +"Raw" queues don't do any filtering at all, they hand the file directly to the +CUPS backend. This backend is responsible for the sending of the data to the device +(as in the "device URI" notation as lpd://, socket://, smb://, ipp://, http://, +parallel:/, serial:/, usb:/ etc.)

            queuepause command   - stop a printer or print queue
    -        queueresume command  - start a printer or print queue

    Example:

    "cupsomatic"/Foomatic are *not* native CUPS drivers and they don't ship with CUPS. +They are a Third Party add-on, developed at Linuxprinting.org. As such, they are +a brilliant hack to make all models (driven by Ghostscript drivers/filters in +traditional spoolers) also work via CUPS, with the same (good or bad!) quality +as in these other spoolers. "cupsomatic" is only a vehicle to execute a ghostscript +commandline at that stage in the CUPS filtering chain, where "normally" the native +CUPS "pstoraster" filter would kick in. cupsomatic by-passes pstoraster, "kidnaps" +the printfile from CUPS away and re-directs it to go through Ghostscipt. CUPS accepts this, +because the associated CUPS-O-Matic-/Foomatic-PPD specifies:

            print command = /usr/bin/lpr -r -P%p %s
    -        lpq command   = /usr/bin/lpq    -P%p %s
    -        lprm command  = /usr/bin/lprm   -P%p %j
    -        queuepause command = /usr/sbin/lpc -P%p stop
    -        queuepause command = /usr/sbin/lpc -P%p start

    Samba should set reasonable defaults for these depending on your -system type, but it isn't clairvoyant. It is not uncommon that you -have to tweak these for local conditions. The commands should -always have fully specified pathnames, as the smdb may not have -the correct PATH values.

    When you send a job to Samba to be printed, it will make a temporary -copy of it in the directory specified in the [printers] section. -and it should be periodically cleaned out. The lpr -r option -requests that the temporary copy be removed after printing; If -printing fails then you might find leftover files in this directory, -and it should be periodically cleaned out. Samba used the lpq -command to determine the "job number" assigned to your print job -by the spooler.

    *cupsFilter: "application/vnd.cups-postscript 0 cupsomatic"

    The %>letter< are "macros" that get dynamically replaced with appropriate -values when they are used. The %s gets replaced with the name of the spool -file that Samba creates and the %p gets replaced with the name of the -printer. The %j gets replaced with the "job number" which comes from -the lpq output.

    This line persuades CUPS to hand the file to cupsomatic, once it has successfully +converted it to the MIME type "application/vnd.cups-postscript". This conversion will not +happen for Jobs arriving from Windows which are auto-typed "application/octet-stream", +with the according changes in "/etc/cups/mime.types" in place.


    14.4.2. Debugging printer problems

    One way to debug printing problems is to start by replacing these -command with shell scripts that record the arguments and the contents -of the print file. A simple example of this kind of things might -be:

    CUPS is widely configurable and flexible, even regarding its filtering mechanism. +Another workaround in some situations would be to have +in "/etc/cups/mime.types" entries as follows:

    	print command = /tmp/saveprint %p %s
    -
    -    #!/bin/saveprint
    -    # we make sure that we are the right user
    -    /usr/bin/id -p >/tmp/tmp.print
    -    # we run the command and save the error messages
    -    # replace the command with the one appropriate for your system
    -    /usr/bin/lpr -r -P$1 $2 2>>&/tmp/tmp.print

    Then you print a file and try removing it. You may find that the -print queue needs to be stopped in order to see the queue status -and remove the job:

    application/postscript application/vnd.cups-raw 0 - + application/vnd.cups-postscript application/vnd.cups-raw 0 -

    This would prevent all Postscript files from being filtered (rather, they will go +thru the virtual "nullfilter" denoted with "-"). This could only be useful for +PS printers. If you want to print PS code on non-PS printers an entry as follows +could be useful:

    
h4: {42} % echo hi >/tmp/hi
    -h4: {43} % smbclient //localhost/lw4
    -added interface ip=10.0.0.4 bcast=10.0.0.255 nmask=255.255.255.0
    -Password: 
    -Domain=[ASTART] OS=[Unix] Server=[Samba 2.0.7]
    -smb: \> print /tmp/hi
    -putting file /tmp/hi as hi-17534 (0.0 kb/s) (average 0.0 kb/s)
    -smb: \> queue
    -1049     3            hi-17534
    -smb: \> cancel 1049
    -Error cancelling job 1049 : code 0
    -smb: \> cancel 1049
    -Job 1049 cancelled
    -smb: \> queue
    -smb: \> exit

    The 'code 0' indicates that the job was removed. The comment -by the smbclient is a bit misleading on this. -You can observe the command output and then and look at the -/tmp/tmp.print file to see what the results are. You can quickly -find out if the problem is with your printing system. Often people -have problems with their /etc/printcap file or permissions on -various print queues.


    14.4.3. What printers do I have?

    */* application/vnd.cups-raw 0 -

    You can use the 'testprns' program to check to see if the printer -name you are using is recognized by Samba. For example, you can -use:

    and would effectively send *all* files to the backend without further processing.

    Lastly, you could have the following entry:

        testprns printer /etc/printcap

    application/vnd.cups-postscript application/vnd.cups-raw 0 my_PJL_stripping_filter

    Samba can get its printcap information from a file or from a program. -You can try the following to see the format of the extracted -information:

    You will need to write a "my_PJL_stripping_filter" (could be a shellscript) that +parses the PostScript and removes the unwanted PJL. This would need to conform to +CUPS filter design (mainly, receive and pass the parameters printername, job-id, +username, jobtitle, copies, print options and possibly the filename). It would +be installed as world executable into "/usr/lib/cups/filters/" and will be called +by CUPS if it encounters a MIME type "application/vnd.cups-postscript".

        testprns -a printer /etc/printcap
    -
    -    testprns -a printer '|/bin/cat printcap'

    CUPS can handle "-o job-hold-until=indefinite". This keeps the job in the queue +"on hold". It will only be printed upon manual release by the printer operator. +This is a requirement in many "central reproduction departments", where a few +operators manage the jobs of hundreds of users on some big machine, where no +user is allowed to have direct access. (The operators often need to load the +proper paper type before running the 10.000 page job requested by marketing +for the mailing, etc.).



    14.4.4. Setting up printcap and print servers

    You may need to set up some printcaps for your Samba system to use. -It is strongly recommended that you use the facilities provided by -the print spooler to set up queues and printcap information.

    Samba requires either a printcap or program to deliver printcap -information. This printcap information has the format:

    15.3. The CUPS Filter Chains

    The following diagrams reveal how CUPS handles print jobs.

      name|alias1|alias2...:option=value:...

    For almost all printing systems, the printer 'name' must be composed -only of alphanumeric or underscore '_' characters. Some systems also -allow hyphens ('-') as well. An alias is an alternative name for the -printer, and an alias with a space in it is used as a 'comment' -about the printer. The printcap format optionally uses a \ at the end of lines -to extend the printcap to multiple lines.

    Here are some examples of printcap files:

    1. pr just printer name

    2. pr|alias printer name and alias

    3. pr|My Printer printer name, alias used as comment

    4. pr:sh:\ Same as pr:sh:cm= testing - :cm= \ - testing

    5. pr:sh Same as pr:sh:cm= testing - :cm= testing

    Samba reads the printcap information when first started. If you make -changes in the printcap information, then you must do the following:

    1. make sure that the print spooler is aware of these changes. -The LPRng system uses the 'lpc reread' command to do this.

    2. make sure that the spool queues, etc., exist and have the -correct permissions. The LPRng system uses the 'checkpc -f' -command to do this.

    3. You now should send a SIGHUP signal to the smbd server to have -it reread the printcap information.


    14.4.5. Job sent, no output

    This is the most frustrating part of printing. You may have sent the -job, verified that the job was forwarded, set up a wrapper around -the command to send the file, but there was no output from the printer.

    First, check to make sure that the job REALLY is getting to the -right print queue. If you are using a BSD or LPRng print spooler, -you can temporarily stop the printing of jobs. Jobs can still be -submitted, but they will not be printed. Use:

    ######################################################################### +# +# CUPS in and of itself has this (general) filter chain (CAPITAL +# letters are FILE-FORMATS or MIME types, other are filters (this is +# true for pre-1.1.15 of pre-4.3 versions of CUPS and ESP PrintPro): +# +# SOMETHNG-FILEFORMAT +# | +# | +# V +# somethingtops +# | +# | +# V +# APPLICATION/POSTSCRIPT +# | +# | +# V +# pstops +# | +# | +# V +# APPLICATION/VND.CUPS-POSTSCRIPT +# | +# | +# V +# pstoraster # as shipped with CUPS, independent from any Ghostscipt +# | # installation on the system +# | (= "postscipt interpreter") +# | +# V +# APPLICATION/VND.CUPS-RASTER +# | +# | +# V +# rastertosomething (f.e. Gimp-Print filters may be plugged in here) +# | (= "raster driver") +# | +# V +# SOMETHING-DEVICE-SPECIFIC +# | +# | +# V +# backend +# +# +# ESP PrintPro has some enhanced "rastertosomething" filters as compared to +# CUPS, and also a somewhat improved "pstoraster" filter. +# +# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to +# CUPS and ESP PrintPro plug-in where rastertosomething is noted. +# +#########################################################################

      lpc -Pprinter stop

    Now submit a print job and then use 'lpq -Pprinter' to see if the -job is in the print queue. If it is not in the print queue then -you will have to find out why it is not being accepted for printing.

    Next, you may want to check to see what the format of the job really -was. With the assistance of the system administrator you can view -the submitted jobs files. You may be surprised to find that these -are not in what you would expect to call a printable format. -You can use the UNIX 'file' utitily to determine what the job -format actually is:

    ######################################################################### +# +# This is how "cupsomatic" comes into play: +# ========================================= +# +# SOMETHNG-FILEFORMAT +# | +# | +# V +# somethingtops +# | +# | +# V +# APPLICATION/POSTSCRIPT +# | +# | +# V +# pstops +# | +# | +# V +# APPLICATION/VND.CUPS-POSTSCRIPT ----------------+ +# | | +# | V +# V cupsomatic +# pstoraster (constructs complicated +# | (= "postscipt interpreter") Ghostscript commandline +# | to let the file be +# V processed by a +# APPLICATION/VND.CUPS-RASTER "-sDEVICE=s.th." +# | call...) +# | | +# V | +# rastertosomething V +# | (= "raster driver") +-------------------------+ +# | | Ghostscript at work.... | +# V | | +# SOMETHING-DEVICE-SPECIFIC *-------------------------+ +# | | +# | | +# V | +# backend >------------------------------------+ +# | +# | +# V +# THE PRINTER +# +# +# Note, that cupsomatic "kidnaps" the printfile after the +# "APPLICATION/VND.CUPS-POSTSCRPT" stage and deviates it through +# the CUPS-external, systemwide Ghostscript installation, bypassing the +# "pstoraster" filter (therefor also bypassing the CUPS-raster-drivers +# "rastertosomething", and hands the rasterized file directly to the CUPS +# backend... +# +# cupsomatic is not made by the CUPS developers. It is an independent +# contribution to printing development, made by people from +# Linuxprinting.org. (see also http://www.cups.org/cups-help.html) +# +# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to +# CUPS and ESP PrintPro plug-in where rastertosomething is noted. +# +#########################################################################

        cd /var/spool/lpd/printer   # spool directory of print jobs
    -    ls                          # find job files
    -    file dfA001myhost

    You should make sure that your printer supports this format OR that -your system administrator has installed a 'print filter' that will -convert the file to a format appropriate for your printer.


    14.4.6. Job sent, strange output

    Once you have the job printing, you can then start worrying about -making it print nicely.

    The most common problem is extra pages of output: banner pages -OR blank pages at the end.

    If you are getting banner pages, check and make sure that the -printcap option or printer option is configured for no banners. -If you have a printcap, this is the :sh (suppress header or banner -page) option. You should have the following in your printer.

    ######################################################################### +# +# And this is how it works for ESP PrintPro from 4.3: +# =================================================== +# +# SOMETHNG-FILEFORMAT +# | +# | +# V +# somethingtops +# | +# | +# V +# APPLICATION/POSTSCRIPT +# | +# | +# V +# pstops +# | +# | +# V +# APPLICATION/VND.CUPS-POSTSCRIPT +# | +# | +# V +# gsrip +# | (= "postscipt interpreter") +# | +# V +# APPLICATION/VND.CUPS-RASTER +# | +# | +# V +# rastertosomething (f.e. Gimp-Print filters may be plugged in here) +# | (= "raster driver") +# | +# V +# SOMETHING-DEVICE-SPECIFIC +# | +# | +# V +# backend +# +# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to +# CUPS and ESP PrintPro plug-in where rastertosomething is noted. +# +#########################################################################

       printer: ... :sh

    If you have this option and are still getting banner pages, there -is a strong chance that your printer is generating them for you -automatically. You should make sure that banner printing is disabled -for the printer. This usually requires using the printer setup software -or procedures supplied by the printer manufacturer.

    If you get an extra page of output, this could be due to problems -with your job format, or if you are generating PostScript jobs, -incorrect setting on your printer driver on the MicroSoft client. -For example, under Win95 there is a option:

    ######################################################################### +# +# This is how "cupsomatic" would come into play with ESP PrintPro: +# ================================================================ +# +# +# SOMETHNG-FILEFORMAT +# | +# | +# V +# somethingtops +# | +# | +# V +# APPLICATION/POSTSCRIPT +# | +# | +# V +# pstops +# | +# | +# V +# APPLICATION/VND.CUPS-POSTSCRIPT ----------------+ +# | | +# | V +# V cupsomatic +# gsrip (constructs complicated +# | (= "postscipt interpreter") Ghostscript commandline +# | to let the file be +# V processed by a +# APPLICATION/VND.CUPS-RASTER "-sDEVICE=s.th." +# | call...) +# | | +# V | +# rastertosomething V +# | (= "raster driver") +-------------------------+ +# | | Ghostscript at work.... | +# V | | +# SOMETHING-DEVICE-SPECIFIC *-------------------------+ +# | | +# | | +# V | +# backend >------------------------------------+ +# | +# | +# V +# THE PRINTER +# +# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to +# CUPS and ESP PrintPro plug-in where rastertosomething is noted. +# +#########################################################################

      Printers|Printer Name|(Right Click)Properties|Postscript|Advanced|

    that allows you to choose if a Ctrl-D is appended to all jobs. -This is a very bad thing to do, as most spooling systems will -automatically add a ^D to the end of the job if it is detected as -PostScript. The multiple ^D may cause an additional page of output.


    14.4.7. Raw PostScript printed

    This is a problem that is usually caused by either the print spooling -system putting information at the start of the print job that makes -the printer think the job is a text file, or your printer simply -does not support PostScript. You may need to enable 'Automatic -Format Detection' on your printer.


    14.4.8. Advanced Printing

    Note that you can do some pretty magic things by using your -imagination with the "print command" option and some shell scripts. -Doing print accounting is easy by passing the %U option to a print -command shell script. You could even make the print command detect -the type of output and its size and send it to an appropriate -printer.


    14.4.9. Real debugging

    If the above debug tips don't help, then maybe you need to bring in -the bug guns, system tracing. See Tracing.txt in this directory.


    Chapter 15. CUPS Printing Support

    15.1. Introduction

    The Common Unix Print System (CUPS) has become very popular, but to many it is -a very mystical tool. There is a great deal of uncertainty regarding CUPS and how -it works. The result is seen in a large number of posting on the samba mailing lists -expressing frustration when MS Windows printers appear not to work with a CUPS -backr-end. -/para>

    This is a good time to point out how CUPS can be used and what it does. CUPS is more -than just a print spooling system - it is a complete printer management system that -complies with HTTP and IPP protocols. It can be managed remotely via a web browser -and it can print using http and ipp protocols.

    CUPS allows to creation of RAW printers (ie: NO file format translation) as well as -SMART printers (ie: CUPS does file format conversion as required for the printer). In -many ways this gives CUPS similar capabilities to the MS Windows print monitoring -system. Of course, if you are a CUPS advocate, you would agrue that CUPS is better! -In any case, let us now move on to explore how one may configure CUPS for interfacing -with MS Windows print clients via Samba.


    15.2. CUPS - RAW Print Through Mode######################################################################### +# +# And this is how it works for CUPS from 1.1.15: +# ============================================== +# +# SOMETHNG-FILEFORMAT +# | +# | +# V +# somethingtops +# | +# | +# V +# APPLICATION/POSTSCRIPT +# | +# | +# V +# pstops +# | +# | +# V +# APPLICATION/VND.CUPS-POSTSCRIPT-----+ +# | +# +------------------v------------------------------+ +# | Ghostscript | +# | at work... | +# | (with | +# | "-sDEVICE=cups") | +# | | +# | (= "postscipt interpreter") | +# | | +# +------------------v------------------------------+ +# | +# | +# APPLICATION/VND.CUPS-RASTER >-------+ +# | +# | +# V +# rastertosomething +# | (= "raster driver") +# | +# V +# SOMETHING-DEVICE-SPECIFIC +# | +# | +# V +# backend +# +# +# NOTE: since version 1.1.15 CUPS "outsourced" the pstoraster process to +# Ghostscript. GNU Ghostscript needs to be patched to handle the +# CUPS requirement; ESP Ghostscript has this builtin. In any case, +# "gs -h" needs to show up a "cups" device. pstoraster is now a +# calling an appropriate "gs -sDEVICE=cups..." commandline to do +# the job. It will output "application/vnd.cup-raster", which will +# be finally processed by a CUPS raster driver "rastertosomething" +# Note the difference to "cupsomatic", which will *not* output +# CUPS-raster, but a final version of the printfile, ready to be +# sent to the printer. cupsomatic also doesn't use the "cups" +# devicemode in Ghostscript, but one of the classical devicemodes.... +# +# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to +# CUPS and ESP PrintPro plug-in where rastertosomething is noted. +# +#########################################################################
    #########################################################################
    +#
    +# And this is how it works for CUPS from 1.1.15, with cupsomatic included:
    +# ========================================================================
    +#
    +# SOMETHNG-FILEFORMAT
    +#      |
    +#      |
    +#      V
    +#     somethingtops
    +#      |
    +#      |
    +#      V
    +# APPLICATION/POSTSCRIPT
    +#      |
    +#      |
    +#      V
    +#     pstops
    +#      |
    +#      |
    +#      V
    +# APPLICATION/VND.CUPS-POSTSCRIPT-----+
    +#                                     |
    +#                  +------------------v------------------------------+
    +#                  | Ghostscript        . Ghostscript at work....    |
    +#                  | at work...         . (with "-sDEVICE=           |
    +#                  | (with              .            s.th."        |
    +#                  | "-sDEVICE=cups")   .                            |
    +#                  |                    .                            |
    +#                  | (CUPS standard)    .      (cupsomatic)          |
    +#                  |                    .                            |
    +#                  |          (= "postscript interpreter")           |
    +#                  |                    .                            |
    +#                  +------------------v--------------v---------------+
    +#                                     |              |
    +#                                     |              |
    +# APPLICATION/VND.CUPS-RASTER >-------+              |
    +#      |                                             |
    +#      |                                             |
    +#      V                                             |
    +#     rastertosomething                            |
    +#      |   (= "raster driver")                       |
    +#      |                                             |
    +#      V                                             |
    +# SOMETHING-DEVICE-SPECIFIC >------------------------+
    +#      |
    +#      |
    +#      V
    +#     backend
    +#
    +#
    +# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
    +#       CUPS and ESP PrintPro plug-in where rastertosomething is noted.
    +#
    +##########################################################################


    15.4. CUPS Print Drivers and Devices

    When CUPS printers are configured for RAW print-through mode operation it is the -responsibility of the Samba client to fully render the print job (file) in a format -that is suitable for direct delivery to the printer. In this case CUPS will NOT -do any print file format conversion work.

    The CUPS files that need to be correctly set for RAW mode printers to work are: +>CUPS ships with good support for HP LaserJet type printers. You can install +the driver as follows:

    • lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd +

    + +(The "-m" switch will retrieve the "laserjet.ppd" from the standard repository +for not-yet-installed-PPDs, which CUPS typically stores in +/etc/cups/mime.types

    /usr/share/cups/model
    . Alternatively, you may use +"-P /absolute/filesystem/path/to/where/there/is/PPD/your.ppd").


    15.4.1. Further printing steps

  • Always also consult the database on linuxprinting.org for all recommendations +about which driver is best used for each printer:

    /etc/cups/mime.convshttp://www.linuxprinting.org/printer_list.cgi

  • - -Both contain entries that must be uncommented to allow There select your model and click on "Show". You'll arrive at a page listing +all drivers working with your model. There will always be *one* +RAWrecommended mode -operation.

    one. Try this one first. In your case +("HP LaserJet 4 Plus"), you'll arrive here:

    Firstly, to enable CUPS based printing from Samba the following options must be -enabled in your smb.conf file [globals] section: - -

    http://www.linuxprinting.org/show_printer.cgi?recnum=75104

    • printing = CUPS

    • The recommended driver is "ljet4". It has a link to the page for the ljet4 +driver too:

      printcap = CUPS

    - -When these parameters are specified the print directives in smb.conf (as well as in -samba itself) will be ignored because samba will directly interface with CUPS through -it's application program interface (API) - so long as Samba has been compiled with -CUPS library (libcups) support. If samba has NOT been compiled with CUPS support then -printing will use the System V AT&T command set with the -oraw -option automatically passing through.

    http://www.linuxprinting.org/show_driver.cgi?driver=ljet4

    Cupsomatic (an enhanced printing utility that is part of some CUPS implementations) -on the Samba/CUPS server does *not* add any features if a file is really -printed "raw". However, if you have loaded the driver for the Windows client from -the CUPS server, using the "cupsaddsmb" utility, and if this driver is one using -a "Foomatic" PPD, the PJL header in question is already added on the Windows client, -at the time when the driver initially generated the PostScript data and CUPS in true -"-oraw" manner doesn't remove this PJL header and passes the file "as is" to its -printer communication backend.

    On the driver's page, you'll find important and detailed info about how to use +that driver within the various available spoolers. You can generate a PPD for +CUPS. The PPD contains all the info about how to use your model and the driver; +this is, once installed, working transparently for the user -- you'll only +need to choose resolution, paper size etc. from the web-based menu or from +the print dialog GUI or from the commandline...

    On the driver's page, choose to use the "PPD-O-Matic" online PPD generator +program. Select your model and click "Generate PPD file". When you safe the +appearing ASCII text file, don't use "cut'n'past" (as it could possiblly corrupt +line endings and tabs), but use "Save as..." in your browser's menu. Save it +at "/some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"

    Then install the printer:

        "lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -P /some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"

    Note, that for all the "Foomatic-PPDs" from Linuxprinting.org, you also need +a special "CUPS filter" named "cupsomatic". Get the latest version of +"cupsomatic" from:

    http://www.linuxprinting.org/cupsomatic

    This needs to be copied to /usr/lib/cups/filter/cupsomatic +and be made world executable. This filter is needed to read and act upon the +specially encoded Foomatic comments, embedded in the printfile, which in turn +are used to construct (transparently for you, the user) the complicated +ghostscript command line needed for your printer/driver combo.

    You can have a look at all the options for the Ghostscript commandline supported +by your printer and the ljet4 driver by going to the section "Execution details", +selecting your model (Laserjet 4 Plus) and clicking on "Show execution details". +This will bring up this web page:

    http://www.linuxprinting.org/execution.cgi?driver=ljet4&printer=75104&.submit=Show+execution+details

    The ingenious thing is that the database is kept current. If there +is a bug fix and an improvement somewhere in the database, you will +always get the most current and stable and feature-rich driver by following +the steps described above.

    Print files that arrive from MS Windows printing are "auto-typed" by CUPS. This aids -the process of determining proper treatment while in the print queue system. - -

    • The latest and greatest improvement now is support for "custom page sizes" +for all those printers which support it.

      Files generated by PCL drivers and directed at PCK printers get auto-typed as - application/octet-stream. Unknown file format types also - get auto-typed with this tag. -

    • "cupsomatic" is documented here:

      Files generated by a Postscript driver and directed at a Postscript printer - are auto-typed depending on the auto-detected most suitable MIME type as: - -

      http://www.linuxprinting.org/cups-doc.html

      • * application/postscript

      • More printing tutorial info may be found here:

        * application/vnd.cups-postscript

      -

    http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/

    "application/postscript" first goes thru the "pstops" filter (where the page counting -and accounting takes place). The outcome will be of MIME type -"application/vnd.cups-postscript". The pstopsfilter reads and uses information from -the PPD and inserts user-provided options into the PostScript file. As a consequence, -the filtered file could possibly have an unwanted PJL header.

    "application/postscript" will be all files with a ".ps", ".ai", ".eps" suffix or which -have as their first character string one of "%!" or "<04>%".

    Note, that *all* the Foomatic drivers listed on Linuxprinting.org (now +approaching the "all-time high" number of 1.000 for the supported models) +are using a special filtering chain involving Ghostscript, as described +in this document.

    "application/vnd.cups-postscript" will files which contain the string -"LANGUAGE=POSTSCRIPT" (or similar variations with different capitalization) in the -first 512 bytes, and also contain the "PJL super escape code" in the first 128 bytes -("<1B>%-12345X"). Very likely, most PostScript files generated on Windows using a CUPS -or other PPD, will have to be auto-typed as "vnd.cups-postscript". A file produced -with a "Generic PostScript driver" will just be tagged "application/postscript".

    Summary - You need:

    Once the file is in "application/vnd.cups-postscript" format, either "pstoraster" -or "cupsomatic" will take over (depending on the printer configuration, as -determined by the PPD in use).

    A "foomatic+something" PPD is not enough to print with CUPS (but it is *one* important component)

    A printer queue with *no* PPD associated to it is a "raw" printer and all files -will go directly there as received by the spooler. The exeptions are file types -"application/octet-stream" which need "passthrough feature" enabled. -"Raw" queues don't do any filtering at all, they hand the file directly to the -CUPS backend. This backend is responsible for the sending of the data to the device -(as in the "device URI" notation as lpd://, socket://, smb://, ipp://, http://, -parallel:/, serial:/, usb:/ etc.)

    The "cupsomatic" filter script (Perl) in /usr/lib/cups/filters/
    Perl to make cupsomatic run
    Ghostscript (because it is called and controlled by the PPD/cupsomatic combo in a way to fit your printermodel/driver combo.
    Ghostscript *must*, depending on the driver/model, contain support for a certain "device" (as shown by "gs -h")

    In the case of the "hpijs" driver, you need a Ghostscript version, which +has "ijs" amongst its supported devices in "gs -h". In the case of +"hpijs+foomatic", a valid ghostscript commandline would be reading like this:

           gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs       \
    +             -sIjsServer=hpijsPageSize -dDuplex=Duplex Model        \
    +             -rResolution,PS:MediaPosition=InputSlot -dIjsUseOutputFD \
    +             -sOutputFile=- -

    "cupsomatic"/Foomatic are *not* native CUPS drivers and they don't ship with CUPS. -They are a Third Party add-on, developed at Linuxprinting.org. As such, they are -a brilliant hack to make all models (driven by Ghostscript drivers/filters in -traditional spoolers) also work via CUPS, with the same (good or bad!) quality -as in these other spoolers. "cupsomatic" is only a vehicle to execute a ghostscript -commandline at that stage in the CUPS filtering chain, where "normally" the native -CUPS "pstoraster" filter would kick in. cupsomatic by-passes pstoraster, "kidnaps" -the printfile from CUPS away and re-directs it to go through Ghostscipt. CUPS accepts this, -because the associated CUPS-O-Matic-/Foomatic-PPD specifies:

       *cupsFilter:  "application/vnd.cups-postscript 0 cupsomatic"

    This line persuades CUPS to hand the file to cupsomatic, once it has successfully -converted it to the MIME type "application/vnd.cups-postscript". This conversion will not -happen for Jobs arriving from Windows which are auto-typed "application/octet-stream", -with the according changes in "/etc/cups/mime.types" in place.

    Note, that with CUPS and the "hpijs+foomatic" PPD (plus Perl and cupsomatic) +you don't need to remember this. You can choose the available print options +thru a GUI print command (like "glp" from ESP's commercially supported +PrintPro software, or KDE's "kprinter", or GNOME's "gtklp" or the independent +"xpp") or the CUPS web interface via human-readable drop-down selection +menus.

    CUPS is widely configurable and flexible, even regarding its filtering mechanism. -Another workaround in some situations would be to have -in "/etc/cups/mime.types" entries as follows:

       application/postscript           application/vnd.cups-raw  0  -
    -   application/vnd.cups-postscript  application/vnd.cups-raw  0  -

    This would prevent all Postscript files from being filtered (rather, they will go -thru the virtual "nullfilter" denoted with "-"). This could only be useful for -PS printers. If you want to print PS code on non-PS printers an entry as follows -could be useful:

       */*           application/vnd.cups-raw  0  -
    If you use "ESP Ghostscript" (also under the GPL, provided by Easy Software +Products, the makers of CUPS, downloadable from +http://www.cups.org/software.html, +co-maintained by the developers of linuxprinting.org), you are guaranteed to +have in use the most uptodate, bug-fixed, enhanced and stable version of a Free +Ghostscript. It contains support for ~300 devices, whereas plain vanilla +GNU Ghostscript 7.05 only has ~200.

    and would effectively send *all* files to the backend without further processing.

    If you print only one CUPS test page, from the web interface and when you try to +print a windows test page, it acts like the job was never sent: + +

    Can you print "standard" jobs from the CUPS machine?
    Are the jobs from Windows visible in the Web interface on CUPS (http://localhost:631/)?
    Most important: What kind of printer driver are you using on the Windows clients?

    Lastly, you could have the following entry:

       application/vnd.cups-postscript  application/vnd.cups-raw  0  my_PJL_stripping_filter

    + +You can try to get a more detailed debugging info by setting "LogLevel debug" in +/etc/cups/cupsd.conf, re-start cupsd and investigate /var/log/cups/error_log +for the whereabouts of your Windows-originating printjobs:

    You will need to write a "my_PJL_stripping_filter" (could be a shellscript) that -parses the PostScript and removes the unwanted PJL. This would need to conform to -CUPS filter design (mainly, receive and pass the parameters printername, job-id, -username, jobtitle, copies, print options and possibly the filename). It would -be installed as world executable into "/usr/lib/cups/filters/" and will be called -by CUPS if it encounters a MIME type "application/vnd.cups-postscript".

    what does the "auto-typing" line say? which is the "MIME type" CUPS thinks is arriving from the Windows clients?
    are there "filter" available for this MIME type?
    are there "filter rules" defined in "/etc/cups/mime.convs" for this MIME type?

    CUPS can handle "-o job-hold-until=indefinite". This keeps the job in the queue -"on hold". It will only be printed upon manual release by the printer operator. -This is a requirement in many "central reproduction departments", where a few -operators manage the jobs of hundreds of users on some big machine, where no -user is allowed to have direct access. (The operators often need to load the -proper paper type before running the 10.000 page job requested by marketing -for the mailing, etc.).


    15.3. The CUPS Filter Chains15.5. Limiting the number of pages users can print

    The following diagrams reveal how CUPS handles print jobs.

    The feature you want is dependent on the real print subsystem you're using. +Samba's part is always to receive the job files from the clients (filtered +*or* unfiltered) and hand it over to this printing subsystem.

    Of course one could "hack" things with one's own scripts.

    But there is CUPS (Common Unix Printing System). CUPS supports "quotas". +Quotas can be based on sizes of jobs or on the number of pages or both, +and are spanning any time period you want.

    This is an example command how root would set a print quota in CUPS, +assuming an existing printer named "quotaprinter":

    #########################################################################
    -#
    -# CUPS in and of itself has this (general) filter chain (CAPITAL
    -# letters are FILE-FORMATS or MIME types, other are filters (this is
    -# true for pre-1.1.15 of pre-4.3 versions of CUPS and ESP PrintPro):
    -#
    -# SOMETHNG-FILEFORMAT
    -#      |
    -#      |
    -#      V
    -#     somethingtops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#     pstops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#     pstoraster   # as shipped with CUPS, independent from any Ghostscipt
    -#      |           # installation on the system
    -#      |  (= "postscipt interpreter")
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-RASTER
    -#      |
    -#      |
    -#      V
    -#     rastertosomething  (f.e. Gimp-Print filters may be plugged in here)
    -#      |   (= "raster driver")
    -#      |
    -#      V
    -# SOMETHING-DEVICE-SPECIFIC
    -#      |
    -#      |
    -#      V
    -#     backend
    -#
    -#
    -# ESP PrintPro has some enhanced "rastertosomething" filters as compared to
    -# CUPS, and also a somewhat improved "pstoraster" filter.
    -#
    -# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
    -#       CUPS and ESP PrintPro plug-in where rastertosomething is noted.
    -#
    -#########################################################################
    lpadmin -p quotaprinter -o job-quota-period=604800 -o job-k-limit=1024 -o job-page-limit=100

    This would limit every single user to print 100 pages or 1024 KB of +data (whichever comes first) within the last 604.800 seconds ( = 1 week).

    For CUPS to count correctly, the printfile needs to pass the CUPS "pstops" filter, +otherwise it uses a "dummy" count of "1". Some printfiles don't pass it +(eg: image files) but then those are mostly 1 page jobs anyway. This also means, +proprietary drivers for the target printer running on the client computers and +CUPS/Samba then spooling these files as "raw" (i.e. leaving them untouched, not +filtering them), will be counted as "1-pagers" too!

    You need to send PostScript from the clients (i.e. run a PostScript driver there) +for having the chance to get accounting done. If the printer is a non-PostScript model, +you need to let CUPS do the job to convert the file to a print-ready format for the +target printer. This will be working for currently ~1.000 different printer models, see

    #########################################################################
    -#
    -# This is how "cupsomatic" comes into play:
    -# =========================================
    -#
    -# SOMETHNG-FILEFORMAT
    -#      |
    -#      |
    -#      V
    -#    somethingtops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#    pstops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
    -#      |                                          |
    -#      |                                          V
    -#      V                                         cupsomatic
    -#    pstoraster                                  (constructs complicated
    -#      |  (= "postscipt interpreter")            Ghostscript commandline
    -#      |                                         to let the file be
    -#      V                                         processed by a
    -# APPLICATION/VND.CUPS-RASTER                    "-sDEVICE=s.th."
    -#      |                                         call...)
    -#      |                                          |
    -#      V                                          |
    -#    rastertosomething                          V
    -#      |    (= "raster driver")     +-------------------------+
    -#      |                            | Ghostscript at work.... |
    -#      V                            |                         |
    -# SOMETHING-DEVICE-SPECIFIC         *-------------------------+
    -#      |                                          |
    -#      |                                          |
    -#      V                                          |
    -#    backend >------------------------------------+
    -#      |
    -#      |
    -#      V
    -#    THE PRINTER
    -#
    -#
    -# Note, that cupsomatic "kidnaps" the printfile after the
    -# "APPLICATION/VND.CUPS-POSTSCRPT" stage and deviates it through
    -# the CUPS-external, systemwide Ghostscript installation, bypassing the
    -# "pstoraster" filter (therefor also bypassing the CUPS-raster-drivers
    -# "rastertosomething", and hands the rasterized file directly to the CUPS
    -# backend...
    -#
    -# cupsomatic is not made by the CUPS developers. It is an independent
    -# contribution to printing development, made by people from
    -# Linuxprinting.org. (see also http://www.cups.org/cups-help.html)
    -#
    -# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
    -#       CUPS and ESP PrintPro plug-in where rastertosomething is noted.
    -#
    -#########################################################################
    #########################################################################
    -#
    -# And this is how it works for ESP PrintPro from 4.3:
    -# ===================================================
    -#
    -# SOMETHNG-FILEFORMAT
    -#      |
    -#      |
    -#      V
    -#     somethingtops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#     pstops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#     gsrip
    -#      |  (= "postscipt interpreter")
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-RASTER
    -#      |
    -#      |
    -#      V
    -#     rastertosomething  (f.e. Gimp-Print filters may be plugged in here)
    -#      |   (= "raster driver")
    -#      |
    -#      V
    -# SOMETHING-DEVICE-SPECIFIC
    -#      |
    -#      |
    -#      V
    -#     backend
    -#
    -# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
    -#       CUPS and ESP PrintPro plug-in where rastertosomething is noted.
    -#
    -#########################################################################
    http://www.linuxprinting.org/printer_list.cgi

    Before CUPS-1.1.16 your only option was to use the Adobe PostScript +Driver on the Windows clients. The output of this driver was not always +passed thru the "pstops" filter on the CUPS/Samba side, and therefor was +not counted correctly (the reason is that it often --- depending on the +"PPD" being used --- did write a "PJL"-header in front of the real +PostScript which made CUPS to skip the pstops and go directy to +the "pstoraster" stage).

    From CUPS-1.1.16 onward you can use the "CUPS PostScript Driver +for Windows NT/2K/XP clients" (it is tagged in the download area of +http://www.cups.org/ as the "cups-samba-1.1.16.tar.gz" package). +It is *not* working for Win9x/ME clients. But it:

    >it guarantees to not write an PJL-header
    it guarantees to still read and support all PJL-options named in the driver PPD with its own means
    it guarantees the file going thru the "pstops" filter on the CUPS/Samba server
    it guarantees to page-count correctly the printfile

    You can read more about the setup of this combination in the +manpage for "cupsaddsmb" (only present with CUPS installed, only +current with CUPS 1.1.16).

    These are the items CUPS logs in the "page_log" for every single *page* of a job:

    #########################################################################
    -#
    -# This is how "cupsomatic" would come into play with ESP PrintPro:
    -# ================================================================
    -#
    -#
    -# SOMETHNG-FILEFORMAT
    -#      |
    -#      |
    -#      V
    -#    somethingtops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#    pstops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-POSTSCRIPT ----------------+
    -#      |                                          |
    -#      |                                          V
    -#      V                                         cupsomatic
    -#    gsrip                                       (constructs complicated
    -#      |  (= "postscipt interpreter")            Ghostscript commandline
    -#      |                                         to let the file be
    -#      V                                         processed by a
    -# APPLICATION/VND.CUPS-RASTER                    "-sDEVICE=s.th."
    -#      |                                         call...)
    -#      |                                          |
    -#      V                                          |
    -#    rastertosomething                          V
    -#      |   (= "raster driver")      +-------------------------+
    -#      |                            | Ghostscript at work.... |
    -#      V                            |                         |
    -# SOMETHING-DEVICE-SPECIFIC         *-------------------------+
    -#      |                                          |
    -#      |                                          |
    -#      V                                          |
    -#    backend >------------------------------------+
    -#      |
    -#      |
    -#      V
    -#    THE PRINTER
    -#
    -# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
    -#       CUPS and ESP PrintPro plug-in where rastertosomething is noted.
    -#
    -#########################################################################
    * Printer name + * User name + * Job ID + * Time of printing + * the page number + * the number of copies + * a billing info string (optional)

    Here is an extract of my CUPS server's page_log file to illustrate +the format and included items:

    #########################################################################
    -#
    -# And this is how it works for CUPS from 1.1.15:
    -# ==============================================
    -#
    -# SOMETHNG-FILEFORMAT
    -#      |
    -#      |
    -#      V
    -#     somethingtops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#     pstops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-POSTSCRIPT-----+
    -#                                     |
    -#                  +------------------v------------------------------+
    -#                  | Ghostscript                                     |
    -#                  | at work...                                      |
    -#                  | (with                                           |
    -#                  | "-sDEVICE=cups")                                |
    -#                  |                                                 |
    -#                  |         (= "postscipt interpreter")             |
    -#                  |                                                 |
    -#                  +------------------v------------------------------+
    -#                                     |
    -#                                     |
    -# APPLICATION/VND.CUPS-RASTER >-------+
    -#      |
    -#      |
    -#      V
    -#     rastertosomething
    -#      |   (= "raster driver")
    -#      |
    -#      V
    -# SOMETHING-DEVICE-SPECIFIC
    -#      |
    -#      |
    -#      V
    -#     backend
    -#
    -#
    -# NOTE: since version 1.1.15 CUPS "outsourced" the pstoraster process to
    -#       Ghostscript. GNU Ghostscript needs to be patched to handle the
    -#       CUPS requirement; ESP Ghostscript has this builtin. In any case,
    -#       "gs -h" needs to show up a "cups" device. pstoraster is now a
    -#       calling an appropriate "gs -sDEVICE=cups..." commandline to do
    -#       the job. It will output "application/vnd.cup-raster", which will
    -#       be finally processed by a CUPS raster driver "rastertosomething"
    -#       Note the difference to "cupsomatic", which will *not* output
    -#       CUPS-raster, but a final version of the printfile, ready to be
    -#       sent to the printer. cupsomatic also doesn't use the "cups"
    -#       devicemode in Ghostscript, but one of the classical devicemodes....
    -#
    -# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to
    -#       CUPS and ESP PrintPro plug-in where rastertosomething is noted.
    -#
    -#########################################################################
    infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 1 2 #marketing + infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 2 2 #marketing + infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 3 2 #marketing + infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 4 2 #marketing + infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 5 2 #marketing + infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 6 2 #marketing

    This was Job ID "40", printed on "infotec_IS2027" by user "kurt", a 6-page job +printed in 2 copies and billed to "#marketing"...

    What flaws or shortcomings are there?

    the ones named above
    CUPS really counts the job pages being *processsed in software* + (going thru the "RIP") rather than the physical sheets successfully + leaving the printing device -- if there is a jam while printing + the 5th sheet out of 1000 and the job is aborted by the printer, + the "page count" will still show the figure of 1000 for that job +
    all quotas are the same for all users (no flexibility to give the + boss a higher quota than the clerk) no support for groups +
    no means to read out the current balance or "used-up" number of current quota +
    a user having used up 99 sheets of 100 quota will still be able to send and print a 1.000 sheet job +
    a user being denied a job because of a filled-up quota doesn't get a meaningful + error message from CUPS other than "client-error-not-possible". +

    But this is the best system out there currently. And there are +huge improvements under development:

    page counting will go into the "backends" (these talk + directly to the printer and will increase the count in sync with the + actual printing process -- a jam at the 5th sheet will lead to a stop in the counting)
    quotas will be handled more flexibly
    probably there will be support for users to inquire their "accounts" in advance
    probably there will be support for some other tools around this topic

    Other than the current stage of the CUPS development, I don't +know any other ready-to-use tool which you could consider.

    You can download the driver files from +http://www.cups.org/software.html. +It is a separate package from the CUPS base software files, tagged as "CUPS 1.1.16 +Windows NT/2k/XP Printer Driver for SAMBA (tar.gz, 192k)". The filename to +download is "cups-samba-1.1.16.tar.gz". Upon untar-/unzip-ping it will reveal +the files:

    #########################################################################
    -#
    -# And this is how it works for CUPS from 1.1.15, with cupsomatic included:
    -# ========================================================================
    -#
    -# SOMETHNG-FILEFORMAT
    -#      |
    -#      |
    -#      V
    -#     somethingtops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/POSTSCRIPT
    -#      |
    -#      |
    -#      V
    -#     pstops
    -#      |
    -#      |
    -#      V
    -# APPLICATION/VND.CUPS-POSTSCRIPT-----+
    -#                                     |
    -#                  +------------------v------------------------------+
    -#                  | Ghostscript        . Ghostscript at work....    |
    -#                  | at work...         . (with "-sDEVICE=           |
    -#                  | (with              .            s.th."        |
    -#                  | "-sDEVICE=cups")   .                            |
    -#                  |                    .                            |
    -#                  | (CUPS standard)    .      (cupsomatic)          |
    -#                  |                    .                            |
    -#                  |          (= "postscript interpreter")           |
    -#                  |                    .                            |
    -#                  +------------------v--------------v---------------+
    -#                                     |              |
    -#                                     |              |
    -# APPLICATION/VND.CUPS-RASTER >-------+              |
    -#      |                                             |
    -#      |                                             |
    -#      V                                             |
    -#     rasterto   cups-samba.install
    +   cups-samba.license
    +   cups-samba.readme
    +   cups-samba.remove
    +   cups-samba.ss

    These have been packaged with the ESP meta packager software "EPM". The +*.install and *.remove files are simple shell script, which untars the +*.ss (which is nothing else than a tar-archive) and puts its contents +into /usr/share/cups/drivers/. Its contents are 3 files:

       cupsdrvr.dll
    +   cupsui.dll
    +   cups.hlp

    ATTENTION: due to a bug one CUPS release puts the cups.hlp +into /usr/share/drivers/ instead of +/usr/share/cups/drivers/. To work around this, copy/move +the file after running the "./cups-samba.install" script manually to the right place:

          cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/

    This new CUPS PostScript driver is currently binary-only, but free +no source code is provided (yet). The reason is this: it has +been developed with the help of the Microsoft Driver Developer Kit (DDK) +and compiled with Microsoft Visual Studio 6. It is not clear to the driver +developers if they are allowed to distribute the whole of the source code +as Free Software. However, they will likely release the "diff" in source +code under the GPL, so anybody with a license of Visual Studio and a DDK +will be able to compile for him/herself.

    Once you have run the install script (and possibly manually moved the +"cups.hlp" file to "/usr/share/cups/drivers/"), the driver is ready to be +put into Samba's [print$] share (which often maps to "/etc/samba/drivers/" +and contains a subdir tree with WIN40 and W32X86 branches), by running +"cupsaddsmb" (see also "man cupsaddsmb" for CUPS 1.1.16). [Don't forget to +put root into the smbpasswd file by running "smbpasswd" should you run +this whole procedure for the first time.] Once the driver files are in the +[print$] share, they are ready to be downloaded and installed by the +Win NT/2k/XP clients.

    NOTE 1: Win 9x/ME clients won't work with this driver. For these you'd +still need to use the ADOBE*.* drivers as previously.

    NOTE 2: It is not harming if you've still the ADOBE*.* driver files from +previous installations in the "/usr/share/cups/drivers/" directory. +The new cupsaddsmb (from 1.1.16) will automatically use the +"newest" installed driver (which here then is the CUPS drivers).

    NOTE 3: Should your Win clients have had the old ADOBE*.* files and the +Adobe PostScript drivers installed, the download and installation +of the new CUPS PostScript driver for Windows NT/2k/XP will fail +at first.

    It is not enough to "delete" the printer (as the driver files +will still be kept by the clients and re-used if you try to +re-install the printer). To really get rid of the Adobe driver +files on the clients, open the "Printers" folder (possibly via +"Start --> Settings --> Control Panel --> Printers"), right-click +onto the folder background and select "Server Properties". A +new dialog opens; select the "Drivers" tab; on the list select +the driver you want to delete and click on the "Delete" button. +(This will only work if there is no single printer left which +uses that particular driver -- you need to "delete" all printers +using this driver in the "Printers" folder first.)

    Once you have successfully downloaded the CUPS PostScript driver +to a client, you can easily switch all printers to this one +by proceeding as described elsewhere in the "Samba HOWTO +Collection" to change a driver for an existing printer.

    What are the benefits with the "CUPS PostScript driver for Windows NT/2k/XP" +as compared to the Adobe drivers?

    • no hassle with the Adobe EULA +

    • no hassle with the question "where do I get the ADOBE*.* driver files from?" +

    • the Adobe drivers (depending on the printer PPD associated with them) + often put a PJL header in front of the core PostScript part of the print + file (thus the file starts with "something | -# | (= "raster driver") | -# | | -# V | -# SOMETHING-DEVICE-SPECIFIC >------------------------+ -# | -# | -# V -# backend -# -# -# NOTE: Gimp-Print and some other 3rd-Party-Filters (like TurboPrint) to -# CUPS and ESP PrintPro plug-in where rasterto1B%-12345X" or "something is noted. -# -##########################################################################escape%-12345X" + instead of "%!PS"). This leads to the CUPS daemon autotyping the + arriving file as a print-ready file, not requiring a pass thru the + "pstops" filter (to speak more technical, it is not regarded as the + generic MIME type "application/postscript", but as the more special + MIME type "application/cups.vnd-postscript"), which therefore also + leads to the page accounting in "/var/log/cups/page_log" not receiving + the exact mumber of pages; instead the dummy page number of "1" is + logged in a standard setup) +

    • the Adobe driver has more options to "mis-configure" the PostScript + generated by it (like setting it inadvertedly to "Optimize for Speed", + instead of "Optimize for Portability", which could lead to CUPS being + unable to process it) +

    • the CUPS PostScript driver output sent by Windows clients to the CUPS + server will be guaranteed to be auto-typed as generic MIME type + "application/postscript", thusly passing thru the CUPS "pstops" filter + and logging the correct number of pages in the page_log for accounting + and quota purposes +

    • the CUPS PostScript driver supports the sending of additional print + options by the Win NT/2k/XP clients, such as naming the CUPS standard + banner pages (or the custom ones, should they be installed at the time + of driver download), using the CUPS "page-label" option, setting a + job-priority and setting the scheduled time of printing (with the option + to support additional useful IPP job attributes in the future). +

    • the CUPS PostScript driver supports the inclusion of the new + "*cupsJobTicket" comments at the beginnig of the PostScript file (which + could be used in the future for all sort of beneficial extensions on + the CUPS side, but which will not disturb any other application as those + will regard it as a comment and simply ignore it). +

    • the CUPS PostScript driver will be the heart of the fully fledged CUPS + IPP client for Windows NT/2k/XP to be released soon (probably alongside + the first Beta release for CUPS 1.2). +


    15.4. CUPS Print Drivers and Devices15.6. Advanced Postscript Printing from MS Windows

    CUPS ships with good support for HP LaserJet type printers. You can install -the driver as follows: - -

    • Let the Windows Clients use a PostScript driver to deliver poistscript to +the samba print server (just like any Linux or Unix Client would also use +PostScript to send to the server)

      lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -m laserjet.ppd -

    - -(The "-m" switch will retrieve the "laserjet.ppd" from the standard repository -for not-yet-installed-PPDs, which CUPS typically stores in -/usr/share/cups/model. Alternatively, you may use -"-P /absolute/filesystem/path/to/where/there/is/PPD/your.ppd").


    15.4.1. Further printing steps

    Make the Unix printing subsystem to which Samba sends the job convert the +incoming PostScript files to the native print format of the target printers +(would be PCL if you have an HP printer)

    Always also consult the database on linuxprinting.org for all recommendations -about which driver is best used for each printer:

    Now if you are afraid that this would just mean using a *Generic* PostScript +driver for the clients that has no Simplex/Duplex selection, and no paper tray +choice, but you need them to be able to set up print jobs, with all the bells +and whistles of your printers:-

    http://www.linuxprinting.org/printer_list.cgi

    Not possible with traditional spooling systems
    But perfectly supported by CUPS (which uses "PPD" files to + describe how to control the print options for PostScript and + non-PostScript devices alike... +

    There select your model and click on "Show". You'll arrive at a page listing -all drivers working with your model. There will always be *one* -recommended one. Try this one first. In your case -("HP LaserJet 4 Plus"), you'll arrive here:

    CUPS PPDs are working perfectly on Windows clients who use Adobe PostScript +drivers (or the new CUPS PostScript driver for Windows NT/2K/XP). Clients can use +them to setup the job to their liking and CUPS will use the received job options +to make the (PCL-, ESC/P- or PostScript-) printer behave as required.

    If you want to have the additional benefit of page count logging and accounting +then the CUPS PostScript driver is the best choice (better than the Adobe one).

    If you want to make the drivers downloadable for the clients then "cupsaddsmb" is +your friend. It will setup the [print$] share on the Samba host to be ready to serve +the clients for a "point and print" driver installation.

    http://www.linuxprinting.org/show_printer.cgi?recnum=75104

    The recommended driver is "ljet4". It has a link to the page for the ljet4 -driver too:

    What strings are attached?

    http://www.linuxprinting.org/show_driver.cgi?driver=ljet4

    There are some. But, given the sheer CPU power you can buy nowadays, +these can be overcome easily. The strings:

    On the driver's page, you'll find important and detailed info about how to use -that driver within the various available spoolers. You can generate a PPD for -CUPS. The PPD contains all the info about how to use your model and the driver; -this is, once installed, working transparently for the user -- you'll only -need to choose resolution, paper size etc. from the web-based menu or from -the print dialog GUI or from the commandline...

    Well, if the CUPS/Samba side will have to print to many printers serving many users, +you probably will need to set up a second server (which can do automatic load balancing +with the first one, plus a degree of fail-over mechanism). Converting the incoming +PostScript jobs, "interpreting" them for non-PostScript printers, amounts to the work +of a "RIP" (Raster Image Processor) done in software. This requires more CPU and RAM +than for the mere "raw spooling" task your current setup is solving. It all depends +on the avarage and peak printing load the server should be able to handle.


    15.7. Auto-Deletion of CUPS spool files

    On the driver's page, choose to use the "PPD-O-Matic" online PPD generator -program. Select your model and click "Generate PPD file". When you safe the -appearing ASCII text file, don't use "cut'n'past" (as it could possiblly corrupt -line endings and tabs), but use "Save as..." in your browser's menu. Save it -at "/some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"

    Samba print files pass thru two "spool" directories. One the incoming directory +managed by Samba, (set eg: in the "path = /var/spool/samba" directive in the [printers] +section of "smb.conf"). Second is the spool directory of your UNIX print subsystem. +For CUPS it is normally "/var/spool/cups/", as set by the cupsd.conf directive +"RequestRoot /var/spool/cups".

    Then install the printer:

    I am not sure, which one of your directories keeps the files. From what you say, +it is most likely the Samba part.

    For the CUPS part, you may want to consult:

        "lpadmin -p laserjet4plus -v parallel:/dev/lp0 -E -P /some/path/on/your/filesystem/somewhere/my-name-for-my-printer.ppd"

    http://localhost:631/sam.html#PreserveJobFiles and + http://localhost:631/sam.html#PreserveJobHistory and + http://localhost:631/sam.html#MaxJobs

    Note, that for all the "Foomatic-PPDs" from Linuxprinting.org, you also need -a special "CUPS filter" named "cupsomatic". Get the latest version of -"cupsomatic" from:

    There are the settings described for your CUPS daemon, which could lead to completed +job files not being deleted.

    http://www.linuxprinting.org/cupsomatic

    "PreserveJobHistory Yes" -- keeps some details of jobs in +cupsd's mind (well it keeps the "c12345", "c12346" etc. files +in the CUPS spool directory, which do a similar job as the +old-fashioned BSD-LPD control files). This is set to "Yes" +as a default.

    This needs to be copied to /usr/lib/cups/filter/cupsomatic -and be made world executable. This filter is needed to read and act upon the -specially encoded Foomatic comments, embedded in the printfile, which in turn -are used to construct (transparently for you, the user) the complicated -ghostscript command line needed for your printer/driver combo.

    "PreserveJobFiles Yes" -- keeps the job files themselves in +cupsd's mind (well it keeps the "d12345", "d12346" etc. files +in the CUPS spool directory...). This is set to "No" as the +CUPS default.

    You can have a look at all the options for the Ghostscript commandline supported -by your printer and the ljet4 driver by going to the section "Execution details", -selecting your model (Laserjet 4 Plus) and clicking on "Show execution details". -This will bring up this web page:

    "MaxJobs 500" -- this directive controls the maximum number +of jobs that are kept in memory. Once the number of jobs +reaches the limit, the oldest completed job is automatically +purged from the system to make room for the new one. If all +of the known jobs are still pending or active then the new +job will be rejected. Setting the maximum to 0 disables this +functionality. The default setting is 0.

    (There are also additional settings for "MaxJobsPerUser" and +"MaxJobsPerPrinter"...)

    For everything to work as announced, you need to have three things:

    http://www.linuxprinting.org/execution.cgi?driver=ljet4&printer=75104&.submit=Show+execution+details

    a Samba-smbd which is compiled against "libcups" (Check on Linux by running "ldd `which smbd`") +
    a Samba-smb.conf setting of "printing = cups" +
    another Samba-smb.conf setting of "printcap = cups" +

    The ingenious thing is that the database is kept current. If there -is a bug fix and an improvement somewhere in the database, you will -always get the most current and stable and feature-rich driver by following -the steps described above.

    Till Kamppeter from MandrakeSoft is doing an excellent job here that too few -people are aware of. (So if you use it often, please send him a note showing -your appreciation).

    Note, that in this case all other manually set printing-related +commands (like "print command", "lpq command", "lprm command", +"lppause command" or "lpresume command") are ignored and they +should normally have no influence what-so-ever on your printing.

    The latest and greatest improvement now is support for "custom page sizes" -for all those printers which support it.

    If you want to do things manually, replace the "printing = cups" +by "printing = bsd". Then your manually set commands may work +(haven't tested this), and a "print command = lp -d %P %s; rm %s" +may do what you need.

    "cupsomatic" is documented here:

    You forgot to mention the CUPS version you're using. If you did +set things up as described in the man pages, then the Samba +spool files should be deleted. Otherwise it may be a bug. On +the CUPS side, you can control the behaviour as described +above.

    If you have more problems, post the output of these commands:

       grep -v ^# /etc/cups/cupsd.conf | grep -v ^$
    +   grep -v ^# /etc/samba/smb.conf | grep -v ^$ | grep -v "^;"

    (adapt paths as needed). These commands sanitize the files +and cut out the empty lines and lines with comments, providing +the "naked settings" in a compact way.


    http://www.linuxprinting.org/cups-doc.htmlChapter 16. Unified Logons between Windows NT and UNIX using Winbind

    16.1. Abstract

    Integration of UNIX and Microsoft Windows NT through + a unified logon has been considered a "holy grail" in heterogeneous + computing environments for a long time. We present + winbind, a component of the Samba suite + of programs as a solution to the unified logon problem. Winbind + uses a UNIX implementation + of Microsoft RPC calls, Pluggable Authentication Modules, and the Name + Service Switch to allow Windows NT domain users to appear and operate + as UNIX users on a UNIX machine. This paper describes the winbind + system, explaining the functionality it provides, how it is configured, + and how it works internally.


    16.2. Introduction

    It is well known that UNIX and Microsoft Windows NT have + different models for representing user and group information and + use different technologies for implementing them. This fact has + made it difficult to integrate the two systems in a satisfactory + manner.

    One common solution in use today has been to create + identically named user accounts on both the UNIX and Windows systems + and use the Samba suite of programs to provide file and print services + between the two. This solution is far from perfect however, as + adding and deleting users on both sets of machines becomes a chore + and two sets of passwords are required both of which + can lead to synchronization problems between the UNIX and Windows + systems and confusion for users.

    We divide the unified logon problem for UNIX machines into + three smaller problems:

    • More printing tutorial info may be found here:

      Obtaining Windows NT user and group information +

    • Authenticating Windows NT users +

    • Password changing for Windows NT users +

    Ideally, a prospective solution to the unified logon problem + would satisfy all the above components without duplication of + information on the UNIX machines and without creating additional + tasks for the system administrator when maintaining users and + groups on either system. The winbind system provides a simple + and elegant solution to all three components of the unified logon + problem.


    16.3. What Winbind Provides

    Winbind unifies UNIX and Windows NT account management by + allowing a UNIX box to become a full member of a NT domain. Once + this is done the UNIX box will see NT users and groups as if + they were native UNIX users and groups, allowing the NT domain + to be used in much the same manner that NIS+ is used within + UNIX-only environments.

    The end result is that whenever any + program on the UNIX machine asks the operating system to lookup + a user or group name, the query will be resolved by asking the + NT domain controller for the specified domain to do the lookup. + Because Winbind hooks into the operating system at a low level + (via the NSS name resolution modules in the C library) this + redirection to the NT domain controller is completely + transparent.

    Users on the UNIX machine can then use NT user and group + names as they would use "native" UNIX names. They can chown files + so that they are owned by NT domain users or even login to the + UNIX machine and run a UNIX X-Window session as a domain user.

    The only obvious indication that Winbind is being used is + that user and group names take the form DOMAIN\user and + DOMAIN\group. This is necessary as it allows Winbind to determine + that redirection to a domain controller is wanted for a particular + lookup and which trusted domain is being referenced.

    Additionally, Winbind provides an authentication service + that hooks into the Pluggable Authentication Modules (PAM) system + to provide authentication via a NT domain to any PAM enabled + applications. This capability solves the problem of synchronizing + passwords between systems since all passwords are stored in a single + location (on the domain controller).


    16.3.1. Target Uses

    Winbind is targeted at organizations that have an + existing NT based domain infrastructure into which they wish + to put UNIX workstations or servers. Winbind will allow these + organizations to deploy UNIX workstations without having to + maintain a separate account infrastructure. This greatly + simplifies the administrative overhead of deploying UNIX + workstations into a NT based organization.

    Another interesting way in which we expect Winbind to + be used is as a central part of UNIX based appliances. Appliances + that provide file and print services to Microsoft based networks + will be able to use Winbind to provide seamless integration of + the appliance into the domain.


    16.4. How Winbind Works

    The winbind system is designed around a client/server + architecture. A long running winbindd daemon + listens on a UNIX domain socket waiting for requests + to arrive. These requests are generated by the NSS and PAM + clients and processed sequentially.

    The technologies used to implement winbind are described + in detail below.


    16.4.1. Microsoft Remote Procedure Calls

    Over the last few years, efforts have been underway + by various Samba Team members to decode various aspects of + the Microsoft Remote Procedure Call (MSRPC) system. This + system is used for most network related operations between + Windows NT machines including remote management, user authentication + and print spooling. Although initially this work was done + to aid the implementation of Primary Domain Controller (PDC) + functionality in Samba, it has also yielded a body of code which + can be used for other purposes.

    Winbind uses various MSRPC calls to enumerate domain users + and groups and to obtain detailed information about individual + users or groups. Other MSRPC calls can be used to authenticate + NT domain users and to change user passwords. By directly querying + a Windows PDC for user and group information, winbind maps the + NT account information onto UNIX user and group names.


    http://www.linuxprinting.org/kpfeifle/LinuxKongress2002/Tutorial/

    16.4.2. Microsoft Active Directory Services

    Note, that *all* the Foomatic drivers listed on Linuxprinting.org (now -approaching the "all-time high" number of 1.000 for the supported models) -are using a special filtering chain involving Ghostscript, as described -in this document.

    Since late 2001, Samba has gained the ability to + interact with Microsoft Windows 2000 using its 'Native + Mode' protocols, rather than the NT4 RPC services. + Using LDAP and Kerberos, a domain member running + winbind can enumerate users and groups in exactly the + same way as a Win2k client would, and in so doing + provide a much more efficient and + effective winbind implementation. +


    16.4.3. Name Service Switch

    Summary - You need:

    The Name Service Switch, or NSS, is a feature that is + present in many UNIX operating systems. It allows system + information such as hostnames, mail aliases and user information + to be resolved from different sources. For example, a standalone + UNIX workstation may resolve system information from a series of + flat files stored on the local filesystem. A networked workstation + may first attempt to resolve system information from local files, + and then consult a NIS database for user information or a DNS server + for hostname information.

    The NSS application programming interface allows winbind + to present itself as a source of system information when + resolving UNIX usernames and groups. Winbind uses this interface, + and information obtained from a Windows NT server using MSRPC + calls to provide a new source of account enumeration. Using standard + UNIX library calls, one can enumerate the users and groups on + a UNIX machine running winbind and see all users and groups in + a NT domain plus any trusted domain as though they were local + users and groups.

    A "foomatic+something" PPD is not enough to print with CUPS (but it is *one* important component)
    The "cupsomatic" filter script (Perl) in The primary control file for NSS is + /usr/lib/cups/filters/
    Perl to make cupsomatic run
    Ghostscript (because it is called and controlled by the PPD/cupsomatic combo in a way to fit your printermodel/driver combo.
    Ghostscript *must*, depending on the driver/model, contain support for a certain "device" (as shown by "gs -h")

    In the case of the "hpijs" driver, you need a Ghostscript version, which -has "ijs" amongst its supported devices in "gs -h". In the case of -"hpijs+foomatic", a valid ghostscript commandline would be reading like this:

    /etc/nsswitch.conf
    . + When a UNIX application makes a request to do a lookup + the C library looks in /etc/nsswitch.conf + for a line which matches the service type being requested, for + example the "passwd" service type is used when user or group names + are looked up. This config line species which implementations + of that service should be tried and in what order. If the passwd + config line is:

           gs -q -dBATCH -dPARANOIDSAFER -dQUIET -dNOPAUSE -sDEVICE=ijs       \
    -             -sIjsServer=hpijsPageSize -dDuplex=Duplex Model        \
    -             -rResolution,PS:MediaPosition=InputSlot -dIjsUseOutputFD \
    -             -sOutputFile=- -
    passwd: files example

    then the C library will first load a module called + /lib/libnss_files.so followed by + the module /lib/libnss_example.so. The + C library will dynamically load each of these modules in turn + and call resolver functions within the modules to try to resolve + the request. Once the request is resolved the C library returns the + result to the application.

    Note, that with CUPS and the "hpijs+foomatic" PPD (plus Perl and cupsomatic) -you don't need to remember this. You can choose the available print options -thru a GUI print command (like "glp" from ESP's commercially supported -PrintPro software, or KDE's "kprinter", or GNOME's "gtklp" or the independent -"xpp") or the CUPS web interface via human-readable drop-down selection -menus.

    This NSS interface provides a very easy way for Winbind + to hook into the operating system. All that needs to be done + is to put libnss_winbind.so in /lib/ + then add "winbind" into /etc/nsswitch.conf at + the appropriate place. The C library will then call Winbind to + resolve user and group names.


    16.4.4. Pluggable Authentication Modules

    If you use "ESP Ghostscript" (also under the GPL, provided by Easy Software -Products, the makers of CUPS, downloadable from -http://www.cups.org/software.html, -co-maintained by the developers of linuxprinting.org), you are guaranteed to -have in use the most uptodate, bug-fixed, enhanced and stable version of a Free -Ghostscript. It contains support for ~300 devices, whereas plain vanilla -GNU Ghostscript 7.05 only has ~200.

    Pluggable Authentication Modules, also known as PAM, + is a system for abstracting authentication and authorization + technologies. With a PAM module it is possible to specify different + authentication methods for different system applications without + having to recompile these applications. PAM is also useful + for implementing a particular policy for authorization. For example, + a system administrator may only allow console logins from users + stored in the local password file but only allow users resolved from + a NIS database to log in over the network.

    If you print only one CUPS test page, from the web interface and when you try to -print a windows test page, it acts like the job was never sent: - -

    Can you print "standard" jobs from the CUPS machine?
    Are the jobs from Windows visible in the Web interface on CUPS (http://localhost:631/)?
    Most important: What kind of printer driver are you using on the Windows clients?
    Winbind uses the authentication management and password + management PAM interface to integrate Windows NT users into a + UNIX system. This allows Windows NT users to log in to a UNIX + machine and be authenticated against a suitable Primary Domain + Controller. These users can also change their passwords and have + this change take effect directly on the Primary Domain Controller. +

    - -You can try to get a more detailed debugging info by setting "LogLevel debug" in -PAM is configured by providing control files in the directory + /etc/pam.d/ for each of the services that + require authentication. When an authentication request is made + by an application the PAM code in the C library looks up this + control file to determine what modules to load to do the + authentication check and in what order. This interface makes adding + a new authentication service for Winbind very easy, all that needs + to be done is that the /etc/cups/cupsd.conf, re-start cupsd and investigate pam_winbind.so module + is copied to /var/log/cups/error_log -for the whereabouts of your Windows-originating printjobs:

    /lib/security/
    and the PAM + control files for relevant services are updated to allow + authentication via winbind. See the PAM documentation + for more details.


    16.4.5. User and Group ID Allocation

    what does the "auto-typing" line say? which is the "MIME type" CUPS thinks is arriving from the Windows clients?
    are there "filter" available for this MIME type?
    are there "filter rules" defined in "/etc/cups/mime.convs" for this MIME type?
    When a user or group is created under Windows NT + is it allocated a numerical relative identifier (RID). This is + slightly different to UNIX which has a range of numbers that are + used to identify users, and the same range in which to identify + groups. It is winbind's job to convert RIDs to UNIX id numbers and + vice versa. When winbind is configured it is given part of the UNIX + user id space and a part of the UNIX group id space in which to + store Windows NT users and groups. If a Windows NT user is + resolved for the first time, it is allocated the next UNIX id from + the range. The same process applies for Windows NT groups. Over + time, winbind will have mapped all Windows NT users and groups + to UNIX user ids and group ids.

    The results of this mapping are stored persistently in + an ID mapping database held in a tdb database). This ensures that + RIDs are mapped to UNIX IDs in a consistent way.


    16.4.6. Result Caching

    An active system can generate a lot of user and group + name lookups. To reduce the network cost of these lookups winbind + uses a caching scheme based on the SAM sequence number supplied + by NT domain controllers. User or group information returned + by a PDC is cached by winbind along with a sequence number also + returned by the PDC. This sequence number is incremented by + Windows NT whenever any user or group information is modified. If + a cached entry has expired, the sequence number is requested from + the PDC and compared against the sequence number of the cached entry. + If the sequence numbers do not match, then the cached information + is discarded and up to date information is requested directly + from the PDC.


    15.5. Limiting the number of pages users can print16.5. Installation and Configuration

    The feature you want is dependent on the real print subsystem you're using. -Samba's part is always to receive the job files from the clients (filtered -*or* unfiltered) and hand it over to this printing subsystem.

    Many thanks to John Trostel jtrostel@snapserver.com +for providing the HOWTO for this section.

    Of course one could "hack" things with one's own scripts.

    This HOWTO describes how to get winbind services up and running +to control access and authenticate users on your Linux box using +the winbind services which come with SAMBA 2.2.2.


    16.5.1. Introduction

    But there is CUPS (Common Unix Printing System). CUPS supports "quotas". -Quotas can be based on sizes of jobs or on the number of pages or both, -and are spanning any time period you want.

    This HOWTO describes the procedures used to get winbind up and +running on my RedHat 7.1 system. Winbind is capable of providing access +and authentication control for Windows Domain users through an NT +or Win2K PDC for 'regular' services, such as telnet a nd ftp, as +well for SAMBA services.

    This is an example command how root would set a print quota in CUPS, -assuming an existing printer named "quotaprinter":

      lpadmin -p quotaprinter -o job-quota-period=604800 -o job-k-limit=1024 -o job-page-limit=100
    This HOWTO has been written from a 'RedHat-centric' perspective, so if +you are using another distribution, you may have to modify the instructions +somewhat to fit the way your distribution works.

    This would limit every single user to print 100 pages or 1024 KB of -data (whichever comes first) within the last 604.800 seconds ( = 1 week).

    • For CUPS to count correctly, the printfile needs to pass the CUPS "pstops" filter, -otherwise it uses a "dummy" count of "1". Some printfiles don't pass it -(eg: image files) but then those are mostly 1 page jobs anyway. This also means, -proprietary drivers for the target printer running on the client computers and -CUPS/Samba then spooling these files as "raw" (i.e. leaving them untouched, not -filtering them), will be counted as "1-pagers" too!

      Why should I to this? +

      You need to send PostScript from the clients (i.e. run a PostScript driver there) -for having the chance to get accounting done. If the printer is a non-PostScript model, -you need to let CUPS do the job to convert the file to a print-ready format for the -target printer. This will be working for currently ~1.000 different printer models, see

           http://www.linuxprinting.org/printer_list.cgi
      This allows the SAMBA administrator to rely on the + authentication mechanisms on the NT/Win2K PDC for the authentication + of domain members. NT/Win2K users no longer need to have separate + accounts on the SAMBA server. +

    • Before CUPS-1.1.16 your only option was to use the Adobe PostScript -Driver on the Windows clients. The output of this driver was not always -passed thru the "pstops" filter on the CUPS/Samba side, and therefor was -not counted correctly (the reason is that it often --- depending on the -"PPD" being used --- did write a "PJL"-header in front of the real -PostScript which made CUPS to skip the pstops and go directy to -the "pstoraster" stage).

      Who should be reading this document? +

      From CUPS-1.1.16 onward you can use the "CUPS PostScript Driver -for Windows NT/2K/XP clients" (it is tagged in the download area of -http://www.cups.org/ as the "cups-samba-1.1.16.tar.gz" package). -It is *not* working for Win9x/ME clients. But it:

      This HOWTO is designed for system administrators. If you are + implementing SAMBA on a file server and wish to (fairly easily) + integrate existing NT/Win2K users from your PDC onto the + SAMBA server, this HOWTO is for you. That said, I am no NT or PAM + expert, so you may find a better or easier way to accomplish + these tasks. +


    16.5.2. Requirements

    If you have a samba configuration file that you are currently +using... BACK IT UP! If your system already uses PAM, +back up the /etc/pam.d directory +contents! If you haven't already made a boot disk, +MAKE ONE NOW!

    >it guarantees to not write an PJL-header
    it guarantees to still read and support all PJL-options named in the driver PPD with its own means
    it guarantees the file going thru the "pstops" filter on the CUPS/Samba server
    it guarantees to page-count correctly the printfile

    Messing with the pam configuration files can make it nearly impossible +to log in to yourmachine. That's why you want to be able to boot back +into your machine in single user mode and restore your +/etc/pam.d back to the original state they were in if +you get frustrated with the way things are going. ;-)

    You can read more about the setup of this combination in the -manpage for "cupsaddsmb" (only present with CUPS installed, only -current with CUPS 1.1.16).

    The latest version of SAMBA (version 3.0 as of this writing), now +includes a functioning winbindd daemon. Please refer to the +main SAMBA web page or, +better yet, your closest SAMBA mirror site for instructions on +downloading the source code.

    These are the items CUPS logs in the "page_log" for every single *page* of a job:

    To allow Domain users the ability to access SAMBA shares and +files, as well as potentially other services provided by your +SAMBA machine, PAM (pluggable authentication modules) must +be setup properly on your machine. In order to compile the +winbind modules, you should have at least the pam libraries resident +on your system. For recent RedHat systems (7.1, for instance), that +means pam-0.74-22. For best results, it is helpful to also +install the development packages in pam-devel-0.74-22.


    16.5.3. Testing Things Out

    	* Printer name
    -	* User name
    -	* Job ID
    -	* Time of printing
    -	* the page number
    -	* the number of copies
    -	* a billing info string (optional)

    Before starting, it is probably best to kill off all the SAMBA +related daemons running on your server. Kill off all smbd, +nmbd, and winbindd processes that may +be running. To use PAM, you will want to make sure that you have the +standard PAM package (for RedHat) which supplies the /etc/pam.d +directory structure, including the pam modules are used by pam-aware +services, several pam libraries, and the /usr/doc +and /usr/man entries for pam. Winbind built better +in SAMBA if the pam-devel package was also installed. This package includes +the header files needed to compile pam-aware applications. For instance, +my RedHat system has both pam-0.74-22 and +pam-devel-0.74-22 RPMs installed.


    16.5.3.1. Configure and compile SAMBA

    Here is an extract of my CUPS server's page_log file to illustrate -the format and included items:

    The configuration and compilation of SAMBA is pretty straightforward. +The first three steps may not be necessary depending upon +whether or not you have previously built the Samba binaries.

    	infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 1 2  #marketing
    -	infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 2 2  #marketing
    -	infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 3 2  #marketing
    -	infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 4 2  #marketing
    -	infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 5 2  #marketing
    -	infotec_IS2027 kurt 40 [22/Nov/2002:13:18:03 +0100] 6 2  #marketing
    root# autoconf +root# make clean +root# rm config.cache +root# ./configure +root# make +root# make install

    This was Job ID "40", printed on "infotec_IS2027" by user "kurt", a 6-page job -printed in 2 copies and billed to "#marketing"...

    What flaws or shortcomings are there?

    This will, by default, install SAMBA in /usr/local/samba. +See the main SAMBA documentation if you want to install SAMBA somewhere else. +It will also build the winbindd executable and libraries.


    16.5.3.2. Configure nsswitch.conf and the +winbind libraries

    the ones named above
    CUPS really counts the job pages being *processsed in software* - (going thru the "RIP") rather than the physical sheets successfully - leaving the printing device -- if there is a jam while printing - the 5th sheet out of 1000 and the job is aborted by the printer, - the "page count" will still show the figure of 1000 for that job -
    all quotas are the same for all users (no flexibility to give the - boss a higher quota than the clerk) no support for groups -
    no means to read out the current balance or "used-up" number of current quota -
    a user having used up 99 sheets of 100 quota will still be able to send and print a 1.000 sheet job -
    a user being denied a job because of a filled-up quota doesn't get a meaningful - error message from CUPS other than "client-error-not-possible". -
    The libraries needed to run the winbindd daemon +through nsswitch need to be copied to their proper locations, so

    root# cp ../samba/source/nsswitch/libnss_winbind.so /lib

    But this is the best system out there currently. And there are -huge improvements under development:

    page counting will go into the "backends" (these talk - directly to the printer and will increase the count in sync with the - actual printing process -- a jam at the 5th sheet will lead to a stop in the counting)
    quotas will be handled more flexibly
    probably there will be support for users to inquire their "accounts" in advance
    probably there will be support for some other tools around this topic
    I also found it necessary to make the following symbolic link:

    root# ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2

    Other than the current stage of the CUPS development, I don't -know any other ready-to-use tool which you could consider.

    You can download the driver files from -http://www.cups.org/software.html. -It is a separate package from the CUPS base software files, tagged as "CUPS 1.1.16 -Windows NT/2k/XP Printer Driver for SAMBA (tar.gz, 192k)". The filename to -download is "cups-samba-1.1.16.tar.gz". Upon untar-/unzip-ping it will reveal -the files:

       cups-samba.install
    -   cups-samba.license
    -   cups-samba.readme
    -   cups-samba.remove
    -   cups-samba.ss
    And, in the case of Sun solaris:

    root# ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1 +root# ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1 +root# ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2

    These have been packaged with the ESP meta packager software "EPM". The -*.install and *.remove files are simple shell script, which untars the -*.ss (which is nothing else than a tar-archive) and puts its contents -into Now, as root you need to edit /usr/share/cups/drivers/. Its contents are 3 files:

    /etc/nsswitch.conf to +allow user and group entries to be visible from the winbindd +daemon. My /etc/nsswitch.conf file look like +this after editing:

       cupsdrvr.dll
    -   cupsui.dll
    -   cups.hlp
    passwd: files winbind + shadow: files + group: files winbind

    +The libraries needed by the winbind daemon will be automatically +entered into the ldconfig cache the next time +your system reboots, but it +is faster (and you don't need to reboot) if you do it manually:

    root# /sbin/ldconfig -v | grep winbind

    ATTENTION: due to a bug one CUPS release puts the This makes cups.hlp -into libnss_winbind available to winbindd +and echos back a check to you.


    16.5.3.3. Configure smb.conf

    Several parameters are needed in the smb.conf file to control +the behavior of winbindd. Configure +/usr/share/drivers/ instead of +>smb.conf These are described in more detail in +the winbindd(8) man page. My /usr/share/cups/drivers/. To work around this, copy/move -the file after running the "./cups-samba.install" script manually to the right place:

    smb.conf file was modified to +include the following entries in the [global] section:

          cp /usr/share/drivers/cups.hlp /usr/share/cups/drivers/
    [global] + <...> + # separate domain and username with '+', like DOMAIN+username + winbind separator = + + # use uids from 10000 to 20000 for domain users + winbind uid = 10000-20000 + # use gids from 10000 to 20000 for domain groups + winbind gid = 10000-20000 + # allow enumeration of winbind users and groups + winbind enum users = yes + winbind enum groups = yes + # give winbind users a real shell (only needed if they have telnet access) + template homedir = /home/winnt/%D/%U + template shell = /bin/bash

    This new CUPS PostScript driver is currently binary-only, but free -no source code is provided (yet). The reason is this: it has -been developed with the help of the Microsoft Driver Developer Kit (DDK) -and compiled with Microsoft Visual Studio 6. It is not clear to the driver -developers if they are allowed to distribute the whole of the source code -as Free Software. However, they will likely release the "diff" in source -code under the GPL, so anybody with a license of Visual Studio and a DDK -will be able to compile for him/herself.


    16.5.3.4. Join the SAMBA server to the PDC domain

    Once you have run the install script (and possibly manually moved the -"cups.hlp" file to "/usr/share/cups/drivers/"), the driver is ready to be -put into Samba's [print$] share (which often maps to "/etc/samba/drivers/" -and contains a subdir tree with WIN40 and W32X86 branches), by running -"cupsaddsmb" (see also "man cupsaddsmb" for CUPS 1.1.16). [Don't forget to -put root into the smbpasswd file by running "smbpasswd" should you run -this whole procedure for the first time.] Once the driver files are in the -[print$] share, they are ready to be downloaded and installed by the -Win NT/2k/XP clients.

    Enter the following command to make the SAMBA server join the +PDC domain, where DOMAIN is the name of +your Windows domain and Administrator is +a domain user who has administrative privileges in the domain.

    root# /usr/local/samba/bin/net join -S PDC -U Administrator

    NOTE 1: Win 9x/ME clients won't work with this driver. For these you'd -still need to use the ADOBE*.* drivers as previously.

    The proper response to the command should be: "Joined the domain +DOMAIN" where DOMAIN +is your DOMAIN name.


    16.5.3.5. Start up the winbindd daemon and test it!

    Eventually, you will want to modify your smb startup script to +automatically invoke the winbindd daemon when the other parts of +SAMBA start, but it is possible to test out just the winbind +portion first. To start up winbind services, enter the following +command as root:

    root# /usr/local/samba/bin/winbindd

    NOTE 2: It is not harming if you've still the ADOBE*.* driver files from -previous installations in the "/usr/share/cups/drivers/" directory. -The new cupsaddsmb (from 1.1.16) will automatically use the -"newest" installed driver (which here then is the CUPS drivers).

    Winbindd can now also run in 'dual daemon mode'. This will make it +run as 2 processes. The first will answer all requests from the cache, +thus making responses to clients faster. The other will +update the cache for the query that the first has just responded. +Advantage of this is that responses stay accurate and are faster. +You can enable dual daemon mode by adding '-B' to the commandline:

    root# /usr/local/samba/bin/winbindd -B

    NOTE 3: Should your Win clients have had the old ADOBE*.* files and the -Adobe PostScript drivers installed, the download and installation -of the new CUPS PostScript driver for Windows NT/2k/XP will fail -at first.

    It is not enough to "delete" the printer (as the driver files -will still be kept by the clients and re-used if you try to -re-install the printer). To really get rid of the Adobe driver -files on the clients, open the "Printers" folder (possibly via -"Start --> Settings --> Control Panel --> Printers"), right-click -onto the folder background and select "Server Properties". A -new dialog opens; select the "Drivers" tab; on the list select -the driver you want to delete and click on the "Delete" button. -(This will only work if there is no single printer left which -uses that particular driver -- you need to "delete" all printers -using this driver in the "Printers" folder first.)

    I'm always paranoid and like to make sure the daemon +is really running...

    root# ps -ae | grep winbindd

    Once you have successfully downloaded the CUPS PostScript driver -to a client, you can easily switch all printers to this one -by proceeding as described elsewhere in the "Samba HOWTO -Collection" to change a driver for an existing printer.

    This command should produce output like this, if the daemon is running

    What are the benefits with the "CUPS PostScript driver for Windows NT/2k/XP" -as compared to the Adobe drivers?

    3025 ? 00:00:00 winbindd

    Now... for the real test, try to get some information about the +users on your PDC

    root# /usr/local/samba/bin/wbinfo -u

    • no hassle with the Adobe EULA -

    • +This should echo back a list of users on your Windows users on +your PDC. For example, I get the following response:

      no hassle with the question "where do I get the ADOBE*.* driver files from?" -

    • CEO+Administrator
      +CEO+burdell
      +CEO+Guest
      +CEO+jt-ad
      +CEO+krbtgt
      +CEO+TsInternetUser

      the Adobe drivers (depending on the printer PPD associated with them) - often put a PJL header in front of the core PostScript part of the print - file (thus the file starts with "1B%-12345X" or "escape%-12345X" - instead of "%!PS"). This leads to the CUPS daemon autotyping the - arriving file as a print-ready file, not requiring a pass thru the - "pstops" filter (to speak more technical, it is not regarded as the - generic MIME type "application/postscript", but as the more special - MIME type "application/cups.vnd-postscript"), which therefore also - leads to the page accounting in "/var/log/cups/page_log" not receiving - the exact mumber of pages; instead the dummy page number of "1" is - logged in a standard setup) -

    • Obviously, I have named my domain 'CEO' and my winbind +separator is '+'.

      the Adobe driver has more options to "mis-configure" the PostScript - generated by it (like setting it inadvertedly to "Optimize for Speed", - instead of "Optimize for Portability", which could lead to CUPS being - unable to process it) -

    • You can do the same sort of thing to get group information from +the PDC:

      the CUPS PostScript driver output sent by Windows clients to the CUPS - server will be guaranteed to be auto-typed as generic MIME type - "application/postscript", thusly passing thru the CUPS "pstops" filter - and logging the correct number of pages in the page_log for accounting - and quota purposes -

    • root# /usr/local/samba/bin/wbinfo -g
      +CEO+Domain Admins
      +CEO+Domain Users
      +CEO+Domain Guests
      +CEO+Domain Computers
      +CEO+Domain Controllers
      +CEO+Cert Publishers
      +CEO+Schema Admins
      +CEO+Enterprise Admins
      +CEO+Group Policy Creator Owners

      the CUPS PostScript driver supports the sending of additional print - options by the Win NT/2k/XP clients, such as naming the CUPS standard - banner pages (or the custom ones, should they be installed at the time - of driver download), using the CUPS "page-label" option, setting a - job-priority and setting the scheduled time of printing (with the option - to support additional useful IPP job attributes in the future). -

    • The function 'getent' can now be used to get unified +lists of both local and PDC users and groups. +Try the following command:

      the CUPS PostScript driver supports the inclusion of the new - "*cupsJobTicket" comments at the beginnig of the PostScript file (which - could be used in the future for all sort of beneficial extensions on - the CUPS side, but which will not disturb any other application as those - will regard it as a comment and simply ignore it). -

    • root# getent passwd

      You should get a list that looks like your /etc/passwd +list followed by the domain users with their new uids, gids, home +directories and default shells.

      the CUPS PostScript driver will be the heart of the fully fledged CUPS - IPP client for Windows NT/2k/XP to be released soon (probably alongside - the first Beta release for CUPS 1.2). -

    The same thing can be done for groups with the command

    root# getent group



    15.6. Advanced Postscript Printing from MS Windows

    Let the Windows Clients use a PostScript driver to deliver poistscript to -the samba print server (just like any Linux or Unix Client would also use -PostScript to send to the server)

    Make the Unix printing subsystem to which Samba sends the job convert the -incoming PostScript files to the native print format of the target printers -(would be PCL if you have an HP printer)

    Now if you are afraid that this would just mean using a *Generic* PostScript -driver for the clients that has no Simplex/Duplex selection, and no paper tray -choice, but you need them to be able to set up print jobs, with all the bells -and whistles of your printers:-

    16.5.3.6. Fix the init.d startup scripts
    16.5.3.6.1. Linux

    Not possible with traditional spooling systems
    But perfectly supported by CUPS (which uses "PPD" files to - describe how to control the print options for PostScript and - non-PostScript devices alike... -
    The winbindd daemon needs to start up after the +smbd and nmbd daemons are running. +To accomplish this task, you need to modify the startup scripts of your system. They are located at /etc/init.d/smb in RedHat and +/etc/init.d/samba in Debian. +script to add commands to invoke this daemon in the proper sequence. My +startup script starts up smbd, +nmbd, and winbindd from the +/usr/local/samba/bin directory directly. The 'start' +function in the script looks like this:

    start() {
    +        KIND="SMB"
    +        echo -n $"Starting $KIND services: "
    +        daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
    +        RETVAL=$?
    +        echo
    +        KIND="NMB"
    +        echo -n $"Starting $KIND services: "
    +        daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
    +        RETVAL2=$?
    +        echo
    +        KIND="Winbind"
    +        echo -n $"Starting $KIND services: "
    +        daemon /usr/local/samba/bin/winbindd
    +        RETVAL3=$?
    +        echo
    +        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && touch /var/lock/subsys/smb || \
    +           RETVAL=1
    +        return $RETVAL
    +}

    CUPS PPDs are working perfectly on Windows clients who use Adobe PostScript -drivers (or the new CUPS PostScript driver for Windows NT/2K/XP). Clients can use -them to setup the job to their liking and CUPS will use the received job options -to make the (PCL-, ESC/P- or PostScript-) printer behave as required.

    If you want to have the additional benefit of page count logging and accounting -then the CUPS PostScript driver is the best choice (better than the Adobe one).

    If you would like to run winbindd in dual daemon mode, replace +the line +
            daemon /usr/local/samba/bin/winbindd
    + +in the example above with: + +
            daemon /usr/local/samba/bin/winbindd -B
    .

    If you want to make the drivers downloadable for the clients then "cupsaddsmb" is -your friend. It will setup the [print$] share on the Samba host to be ready to serve -the clients for a "point and print" driver installation.

    The 'stop' function has a corresponding entry to shut down the +services and looks like this:

    stop() {
    +        KIND="SMB"
    +        echo -n $"Shutting down $KIND services: "
    +        killproc smbd
    +        RETVAL=$?
    +        echo
    +        KIND="NMB"
    +        echo -n $"Shutting down $KIND services: "
    +        killproc nmbd
    +        RETVAL2=$?
    +        echo
    +        KIND="Winbind"
    +        echo -n $"Shutting down $KIND services: "
    +        killproc winbindd
    +        RETVAL3=$?
    +        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && rm -f /var/lock/subsys/smb
    +        echo ""
    +        return $RETVAL
    +}

    What strings are attached?


    16.5.3.6.2. Solaris

    There are some. But, given the sheer CPU power you can buy nowadays, -these can be overcome easily. The strings:

    On solaris, you need to modify the +/etc/init.d/samba.server startup script. It usually +only starts smbd and nmbd but should now start winbindd too. If you +have samba installed in /usr/local/samba/bin, +the file could contains something like this:

    ##
    +## samba.server
    +##
    +
    +if [ ! -d /usr/bin ]
    +then                    # /usr not mounted
    +        exit
    +fi
    +
    +killproc() {            # kill the named process(es)
    +        pid=`/usr/bin/ps -e |
    +             /usr/bin/grep -w $1 |
    +             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
    +        [ "$pid" != "" ] && kill $pid
    +}
    + 
    +# Start/stop processes required for samba server
    +
    +case "$1" in
    +
    +'start')
    +#
    +# Edit these lines to suit your installation (paths, workgroup, host)
    +#
    +echo Starting SMBD
    +   /usr/local/samba/bin/smbd -D -s \
    +	/usr/local/samba/smb.conf
    +
    +echo Starting NMBD
    +   /usr/local/samba/bin/nmbd -D -l \
    +	/usr/local/samba/var/log -s /usr/local/samba/smb.conf
    +
    +echo Starting Winbind Daemon
    +   /usr/local/samba/bin/winbindd
    +   ;;
    +
    +'stop')
    +   killproc nmbd
    +   killproc smbd
    +   killproc winbindd
    +   ;;
    +
    +*)
    +   echo "Usage: /etc/init.d/samba.server { start | stop }"
    +   ;;
    +esac

    Well, if the CUPS/Samba side will have to print to many printers serving many users, -you probably will need to set up a second server (which can do automatic load balancing -with the first one, plus a degree of fail-over mechanism). Converting the incoming -PostScript jobs, "interpreting" them for non-PostScript printers, amounts to the work -of a "RIP" (Raster Image Processor) done in software. This requires more CPU and RAM -than for the mere "raw spooling" task your current setup is solving. It all depends -on the avarage and peak printing load the server should be able to handle.

    Again, if you would like to run samba in dual daemon mode, replace +
       /usr/local/samba/bin/winbindd
    + +in the script above with: + +
       /usr/local/samba/bin/winbindd -B



    15.7. Auto-Deletion of CUPS spool files
    16.5.3.6.3. Restarting

    Samba print files pass thru two "spool" directories. One the incoming directory -managed by Samba, (set eg: in the "path = /var/spool/samba" directive in the [printers] -section of "smb.conf"). Second is the spool directory of your UNIX print subsystem. -For CUPS it is normally "/var/spool/cups/", as set by the cupsd.conf directive -"RequestRoot /var/spool/cups".

    If you restart the smbd, nmbd, +and winbindd daemons at this point, you +should be able to connect to the samba server as a domain member just as +if you were a local user.


    16.5.3.7. Configure Winbind and PAM

    I am not sure, which one of your directories keeps the files. From what you say, -it is most likely the Samba part.

    If you have made it this far, you know that winbindd and samba are working +together. If you want to use winbind to provide authentication for other +services, keep reading. The pam configuration files need to be altered in +this step. (Did you remember to make backups of your original +/etc/pam.d files? If not, do it now.)

    For the CUPS part, you may want to consult:

       http://localhost:631/sam.html#PreserveJobFiles and
    -   http://localhost:631/sam.html#PreserveJobHistory and
    -   http://localhost:631/sam.html#MaxJobs
    You will need a pam module to use winbindd with these other services. This +module will be compiled in the ../source/nsswitch directory +by invoking the command

    There are the settings described for your CUPS daemon, which could lead to completed -job files not being deleted.

    root# make nsswitch/pam_winbind.so

    "PreserveJobHistory Yes" -- keeps some details of jobs in -cupsd's mind (well it keeps the "c12345", "c12346" etc. files -in the CUPS spool directory, which do a similar job as the -old-fashioned BSD-LPD control files). This is set to "Yes" -as a default.

    from the ../source directory. The +pam_winbind.so file should be copied to the location of +your other pam security modules. On my RedHat system, this was the +/lib/security directory. On Solaris, the pam security +modules reside in /usr/lib/security.

    "PreserveJobFiles Yes" -- keeps the job files themselves in -cupsd's mind (well it keeps the "d12345", "d12346" etc. files -in the CUPS spool directory...). This is set to "No" as the -CUPS default.

    root# cp ../samba/source/nsswitch/pam_winbind.so /lib/security


    16.5.3.7.1. Linux/FreeBSD-specific PAM configuration

    "MaxJobs 500" -- this directive controls the maximum number -of jobs that are kept in memory. Once the number of jobs -reaches the limit, the oldest completed job is automatically -purged from the system to make room for the new one. If all -of the known jobs are still pending or active then the new -job will be rejected. Setting the maximum to 0 disables this -functionality. The default setting is 0.

    The /etc/pam.d/samba file does not need to be changed. I +just left this fileas it was:

    (There are also additional settings for "MaxJobsPerUser" and -"MaxJobsPerPrinter"...)

    auth    required        /lib/security/pam_stack.so service=system-auth
    +account required        /lib/security/pam_stack.so service=system-auth

    For everything to work as announced, you need to have three things:

    The other services that I modified to allow the use of winbind +as an authentication service were the normal login on the console (or a terminal +session), telnet logins, and ftp service. In order to enable these +services, you may first need to change the entries in +/etc/xinetd.d (or /etc/inetd.conf). +RedHat 7.1 uses the new xinetd.d structure, in this case you need +to change the lines in /etc/xinetd.d/telnet +and /etc/xinetd.d/wu-ftp from

    enable = no

    a Samba-smbd which is compiled against "libcups" (Check on Linux by running "ldd `which smbd`") -
    a Samba-smb.conf setting of "printing = cups" -
    another Samba-smb.conf setting of "printcap = cups" -

    to

    enable = yes

    Note, that in this case all other manually set printing-related -commands (like "print command", "lpq command", "lprm command", -"lppause command" or "lpresume command") are ignored and they -should normally have no influence what-so-ever on your printing.

    If you want to do things manually, replace the "printing = cups" -by "printing = bsd". Then your manually set commands may work -(haven't tested this), and a "print command = lp -d %P %s; rm %s" -may do what you need.

    +For ftp services to work properly, you will also need to either +have individual directories for the domain users already present on +the server, or change the home directory template to a general +directory for all domain users. These can be easily set using +the smb.conf global entry +template homedir.

    You forgot to mention the CUPS version you're using. If you did -set things up as described in the man pages, then the Samba -spool files should be deleted. Otherwise it may be a bug. On -the CUPS side, you can control the behaviour as described -above.

    The /etc/pam.d/ftp file can be changed +to allow winbind ftp access in a manner similar to the +samba file. My /etc/pam.d/ftp file was +changed to look like this:

    If you have more problems, post the output of these commands:

    auth       required     /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
    +auth       sufficient   /lib/security/pam_winbind.so
    +auth       required     /lib/security/pam_stack.so service=system-auth
    +auth       required     /lib/security/pam_shells.so
    +account    sufficient   /lib/security/pam_winbind.so
    +account    required     /lib/security/pam_stack.so service=system-auth
    +session    required     /lib/security/pam_stack.so service=system-auth

    The /etc/pam.d/login file can be changed nearly the +same way. It now looks like this:

       grep -v ^# /etc/cups/cupsd.conf | grep -v ^$
    -   grep -v ^# /etc/samba/smb.conf | grep -v ^$ | grep -v "^;"
    auth required /lib/security/pam_securetty.so +auth sufficient /lib/security/pam_winbind.so +auth sufficient /lib/security/pam_unix.so use_first_pass +auth required /lib/security/pam_stack.so service=system-auth +auth required /lib/security/pam_nologin.so +account sufficient /lib/security/pam_winbind.so +account required /lib/security/pam_stack.so service=system-auth +password required /lib/security/pam_stack.so service=system-auth +session required /lib/security/pam_stack.so service=system-auth +session optional /lib/security/pam_console.so

    (adapt paths as needed). These commands sanitize the files -and cut out the empty lines and lines with comments, providing -the "naked settings" in a compact way.

    In this case, I added the auth sufficient /lib/security/pam_winbind.so +lines as before, but also added the required pam_securetty.so +above it, to disallow root logins over the network. I also added a +sufficient /lib/security/pam_unix.so use_first_pass +line after the winbind.so line to get rid of annoying +double prompts for passwords.


    Chapter 16. Unified Logons between Windows NT and UNIX using Winbind


    16.1. Abstract
    16.5.3.7.2. Solaris-specific configuration

    Integration of UNIX and Microsoft Windows NT through - a unified logon has been considered a "holy grail" in heterogeneous - computing environments for a long time. We present - winbind, a component of the Samba suite - of programs as a solution to the unified logon problem. Winbind - uses a UNIX implementation - of Microsoft RPC calls, Pluggable Authentication Modules, and the Name - Service Switch to allow Windows NT domain users to appear and operate - as UNIX users on a UNIX machine. This paper describes the winbind - system, explaining the functionality it provides, how it is configured, - and how it works internally.

    The /etc/pam.conf needs to be changed. I changed this file so that my Domain +users can logon both locally as well as telnet.The following are the changes +that I made.You can customize the pam.conf file as per your requirements,but +be sure of those changes because in the worst case it will leave your system +nearly impossible to boot.

    #
    +#ident	"@(#)pam.conf	1.14	99/09/16 SMI"
    +#
    +# Copyright (c) 1996-1999, Sun Microsystems, Inc.
    +# All Rights Reserved.
    +#
    +# PAM configuration
    +#
    +# Authentication management
    +#
    +login   auth required   /usr/lib/security/pam_winbind.so
    +login	auth required 	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass 
    +login	auth required 	/usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass 
    +#
    +rlogin  auth sufficient /usr/lib/security/pam_winbind.so
    +rlogin  auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
    +rlogin	auth required 	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
    +#
    +dtlogin auth sufficient /usr/lib/security/pam_winbind.so
    +dtlogin	auth required 	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
    +#
    +rsh	auth required	/usr/lib/security/$ISA/pam_rhosts_auth.so.1
    +other   auth sufficient /usr/lib/security/pam_winbind.so
    +other	auth required	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
    +#
    +# Account management
    +#
    +login   account sufficient      /usr/lib/security/pam_winbind.so
    +login	account requisite	/usr/lib/security/$ISA/pam_roles.so.1 
    +login	account required	/usr/lib/security/$ISA/pam_unix.so.1 
    +#
    +dtlogin account sufficient      /usr/lib/security/pam_winbind.so
    +dtlogin	account requisite	/usr/lib/security/$ISA/pam_roles.so.1 
    +dtlogin	account required	/usr/lib/security/$ISA/pam_unix.so.1 
    +#
    +other   account sufficient      /usr/lib/security/pam_winbind.so
    +other	account requisite	/usr/lib/security/$ISA/pam_roles.so.1 
    +other	account required	/usr/lib/security/$ISA/pam_unix.so.1 
    +#
    +# Session management
    +#
    +other	session required	/usr/lib/security/$ISA/pam_unix.so.1 
    +#
    +# Password management
    +#
    +#other   password sufficient     /usr/lib/security/pam_winbind.so
    +other	password required	/usr/lib/security/$ISA/pam_unix.so.1 
    +dtsession auth required	/usr/lib/security/$ISA/pam_unix.so.1
    +#
    +# Support for Kerberos V5 authentication (uncomment to use Kerberos)
    +#
    +#rlogin	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
    +#login	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
    +#dtlogin	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
    +#other	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
    +#dtlogin	account optional /usr/lib/security/$ISA/pam_krb5.so.1
    +#other	account optional /usr/lib/security/$ISA/pam_krb5.so.1
    +#other	session optional /usr/lib/security/$ISA/pam_krb5.so.1
    +#other	password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass

    I also added a try_first_pass line after the winbind.so line to get rid of +annoying double prompts for passwords.

    Now restart your Samba and try connecting through your application that you +configured in the pam.conf.


    16.2. Introduction16.6. Limitations

    It is well known that UNIX and Microsoft Windows NT have - different models for representing user and group information and - use different technologies for implementing them. This fact has - made it difficult to integrate the two systems in a satisfactory - manner.

    One common solution in use today has been to create - identically named user accounts on both the UNIX and Windows systems - and use the Samba suite of programs to provide file and print services - between the two. This solution is far from perfect however, as - adding and deleting users on both sets of machines becomes a chore - and two sets of passwords are required both of which - can lead to synchronization problems between the UNIX and Windows - systems and confusion for users.

    We divide the unified logon problem for UNIX machines into - three smaller problems:

    Winbind has a number of limitations in its current + released version that we hope to overcome in future + releases:

    • Obtaining Windows NT user and group information -

      Winbind is currently only available for + the Linux, Solaris and IRIX operating systems, although ports to other operating + systems are certainly possible. For such ports to be feasible, + we require the C library of the target operating system to + support the Name Service Switch and Pluggable Authentication + Modules systems. This is becoming more common as NSS and + PAM gain support among UNIX vendors.

    • Authenticating Windows NT users -

      The mappings of Windows NT RIDs to UNIX ids + is not made algorithmically and depends on the order in which + unmapped users or groups are seen by winbind. It may be difficult + to recover the mappings of rid to UNIX id mapping if the file + containing this information is corrupted or destroyed.

    • Password changing for Windows NT users -

    Ideally, a prospective solution to the unified logon problem - would satisfy all the above components without duplication of - information on the UNIX machines and without creating additional - tasks for the system administrator when maintaining users and - groups on either system. The winbind system provides a simple - and elegant solution to all three components of the unified logon - problem.


    16.3. What Winbind Provides

    Winbind unifies UNIX and Windows NT account management by - allowing a UNIX box to become a full member of a NT domain. Once - this is done the UNIX box will see NT users and groups as if - they were native UNIX users and groups, allowing the NT domain - to be used in much the same manner that NIS+ is used within - UNIX-only environments.

    The end result is that whenever any - program on the UNIX machine asks the operating system to lookup - a user or group name, the query will be resolved by asking the - NT domain controller for the specified domain to do the lookup. - Because Winbind hooks into the operating system at a low level - (via the NSS name resolution modules in the C library) this - redirection to the NT domain controller is completely - transparent.

    Users on the UNIX machine can then use NT user and group - names as they would use "native" UNIX names. They can chown files - so that they are owned by NT domain users or even login to the - UNIX machine and run a UNIX X-Window session as a domain user.

    The only obvious indication that Winbind is being used is - that user and group names take the form DOMAIN\user and - DOMAIN\group. This is necessary as it allows Winbind to determine - that redirection to a domain controller is wanted for a particular - lookup and which trusted domain is being referenced.

    Additionally, Winbind provides an authentication service - that hooks into the Pluggable Authentication Modules (PAM) system - to provide authentication via a NT domain to any PAM enabled - applications. This capability solves the problem of synchronizing - passwords between systems since all passwords are stored in a single - location (on the domain controller).

    Currently the winbind PAM module does not take + into account possible workstation and logon time restrictions + that may be been set for Windows NT users, this is + instead up to the PDC to enforce.



    16.3.1. Target Uses

    Winbind is targeted at organizations that have an - existing NT based domain infrastructure into which they wish - to put UNIX workstations or servers. Winbind will allow these - organizations to deploy UNIX workstations without having to - maintain a separate account infrastructure. This greatly - simplifies the administrative overhead of deploying UNIX - workstations into a NT based organization.

    16.7. Conclusion

    Another interesting way in which we expect Winbind to - be used is as a central part of UNIX based appliances. Appliances - that provide file and print services to Microsoft based networks - will be able to use Winbind to provide seamless integration of - the appliance into the domain.

    The winbind system, through the use of the Name Service + Switch, Pluggable Authentication Modules, and appropriate + Microsoft RPC calls have allowed us to provide seamless + integration of Microsoft Windows NT domain users on a + UNIX system. The result is a great reduction in the administrative + cost of running a mixed UNIX and NT network.


    Chapter 17. Policy Management - Hows and Whys


    16.4. How Winbind Works17.1. System Policies

    The winbind system is designed around a client/server - architecture. A long running winbindd daemon - listens on a UNIX domain socket waiting for requests - to arrive. These requests are generated by the NSS and PAM - clients and processed sequentially.

    Under MS Windows platforms, particularly those following the release of MS Windows +NT4 and MS Windows 95) it is possible to create a type of file that would be placed +in the NETLOGON share of a domain controller. As the client logs onto the network +this file is read and the contents initiate changes to the registry of the client +machine. This file allows changes to be made to those parts of the registry that +affect users, groups of users, or machines.

    The technologies used to implement winbind are described - in detail below.


    16.4.1. Microsoft Remote Procedure Calls

    For MS Windows 9x/Me this file must be called Config.POL and may +be generated using a tool called poledit.exe, better known as the +Policy Editor. The policy editor was provided on the Windows 98 installation CD, but +dissappeared again with the introduction of MS Windows Me (Millenium Edition). From +comments from MS Windows network administrators it would appear that this tool became +a part of the MS Windows Me Resource Kit.

    MS Windows NT4 Server products include the System Policy Editor +under the Start->Programs->Administrative Tools menu item. +For MS Windows NT4 and later clients this file must be called NTConfig.POL.

    Over the last few years, efforts have been underway - by various Samba Team members to decode various aspects of - the Microsoft Remote Procedure Call (MSRPC) system. This - system is used for most network related operations between - Windows NT machines including remote management, user authentication - and print spooling. Although initially this work was done - to aid the implementation of Primary Domain Controller (PDC) - functionality in Samba, it has also yielded a body of code which - can be used for other purposes.

    New with the introduction of MS Windows 2000 was the Microsoft Management Console +or MMC. This tool is the new wave in the ever changing landscape of Microsoft +methods for management of network access and security. Every new Microsoft product +or technology seems to obsolete the old rules and to introduce newer and more +complex tools and methods. To Microsoft's credit though, the MMC does appear to +be a step forward, but improved functionality comes at a great price.

    Winbind uses various MSRPC calls to enumerate domain users - and groups and to obtain detailed information about individual - users or groups. Other MSRPC calls can be used to authenticate - NT domain users and to change user passwords. By directly querying - a Windows PDC for user and group information, winbind maps the - NT account information onto UNIX user and group names.


    16.4.2. Microsoft Active Directory Services

    Before embarking on the configuration of network and system policies it is highly +advisable to read the documentation available from Microsoft's web site from +Implementing Profiles and Policies in Windows NT 4.0 available from Microsoft. +There are a large number of documents in addition to this old one that should also +be read and understood. Try searching on the Microsoft web site for "Group Policies".

    Since late 2001, Samba has gained the ability to - interact with Microsoft Windows 2000 using its 'Native - Mode' protocols, rather than the NT4 RPC services. - Using LDAP and Kerberos, a domain member running - winbind can enumerate users and groups in exactly the - same way as a Win2k client would, and in so doing - provide a much more efficient and - effective winbind implementation. -

    What follows is a very discussion with some helpful notes. The information provided +here is incomplete - you are warned.


    16.4.3. Name Service Switch17.1.1. Creating and Managing Windows 9x/Me Policies

    The Name Service Switch, or NSS, is a feature that is - present in many UNIX operating systems. It allows system - information such as hostnames, mail aliases and user information - to be resolved from different sources. For example, a standalone - UNIX workstation may resolve system information from a series of - flat files stored on the local filesystem. A networked workstation - may first attempt to resolve system information from local files, - and then consult a NIS database for user information or a DNS server - for hostname information.

    The NSS application programming interface allows winbind - to present itself as a source of system information when - resolving UNIX usernames and groups. Winbind uses this interface, - and information obtained from a Windows NT server using MSRPC - calls to provide a new source of account enumeration. Using standard - UNIX library calls, one can enumerate the users and groups on - a UNIX machine running winbind and see all users and groups in - a NT domain plus any trusted domain as though they were local - users and groups.

    You need the Win98 Group Policy Editor to set Group Profiles up under Windows 9x/Me. +It can be found on the Original full product Win98 installation CD under +tools/reskit/netadmin/poledit. You install this using the +Add/Remove Programs facility and then click on the 'Have Disk' tab.

    The primary control file for NSS is - Use the Group Policy Editor to create a policy file that specifies the location of +user profiles and/or the /etc/nsswitch.conf. - When a UNIX application makes a request to do a lookup - the C library looks in My Documents etc. stuff. You then +save these settings in a file called /etc/nsswitch.conf - for a line which matches the service type being requested, for - example the "passwd" service type is used when user or group names - are looked up. This config line species which implementations - of that service should be tried and in what order. If the passwd - config line is:

    Config.POL that needs to +be placed in the root of the [NETLOGON] share. If your Win98 is configured to log onto +the Samba Domain, it will automatically read this file and update the Win9x/Me registry +of the machine that is logging on.

    passwd: files example

    Further details are covered in the Win98 Resource Kit documentation.

    then the C library will first load a module called - /lib/libnss_files.so followed by - the module /lib/libnss_example.so. The - C library will dynamically load each of these modules in turn - and call resolver functions within the modules to try to resolve - the request. Once the request is resolved the C library returns the - result to the application.

    If you do not do it this way, then every so often Win9x/Me will check the +integrity of the registry and will restore it's settings from the back-up +copy of the registry it stores on each Win9x/Me machine. Hence, you will +occasionally notice things changing back to the original settings.

    This NSS interface provides a very easy way for Winbind - to hook into the operating system. All that needs to be done - is to put libnss_winbind.so in Install the group policy handler for Win9x to pick up group policies. Look on the +Win98 CD in /lib/ - then add "winbind" into \tools\reskit\netadmin\poledit. +Install group policies on a Win9x client by double-clicking +/etc/nsswitch.conf at - the appropriate place. The C library will then call Winbind to - resolve user and group names.

    grouppol.inf. Log off and on again a couple of times and see +if Win98 picks up group policies. Unfortunately this needs to be done on every +Win9x/Me machine that uses group policies.


    16.4.4. Pluggable Authentication Modules17.1.2. Creating and Managing Windows NT4 Style Policy Files

    Pluggable Authentication Modules, also known as PAM, - is a system for abstracting authentication and authorization - technologies. With a PAM module it is possible to specify different - authentication methods for different system applications without - having to recompile these applications. PAM is also useful - for implementing a particular policy for authorization. For example, - a system administrator may only allow console logins from users - stored in the local password file but only allow users resolved from - a NIS database to log in over the network.

    Winbind uses the authentication management and password - management PAM interface to integrate Windows NT users into a - UNIX system. This allows Windows NT users to log in to a UNIX - machine and be authenticated against a suitable Primary Domain - Controller. These users can also change their passwords and have - this change take effect directly on the Primary Domain Controller. -

    To create or edit ntconfig.pol you must use the NT Server +Policy Editor, poledit.exe which is included with NT4 Server +but not NT Workstation. There is a Policy Editor on a NT4 +Workstation but it is not suitable for creating Domain Policies. +Further, although the Windows 95 Policy Editor can be installed on an NT4 +Workstation/Server, it will not work with NT clients. However, the files from +the NT Server will run happily enough on an NT4 Workstation.

    PAM is configured by providing control files in the directory - You need /etc/pam.d/ for each of the services that - require authentication. When an authentication request is made - by an application the PAM code in the C library looks up this - control file to determine what modules to load to do the - authentication check and in what order. This interface makes adding - a new authentication service for Winbind very easy, all that needs - to be done is that the poledit.exe, common.adm and pam_winbind.so module - is copied to winnt.adm. +It is convenient to put the two *.adm files in the /lib/security/ and the PAM - control files for relevant services are updated to allow - authentication via winbind. See the PAM documentation - for more details.


    c:\winnt\inf +directory which is where the binary will look for them unless told otherwise. Note also that that +directory is normally 'hidden'.

    The Windows NT policy editor is also included with the Service Pack 3 (and +later) for Windows NT 4.0. Extract the files using servicepackname /x, +i.e. that's Nt4sp6ai.exe /x for service pack 6a. The policy editor, +poledit.exe and the associated template files (*.adm) should +be extracted as well. It is also possible to downloaded the policy template +files for Office97 and get a copy of the policy editor. Another possible +location is with the Zero Administration Kit available for download from Microsoft.


    16.4.5. User and Group ID Allocation

    When a user or group is created under Windows NT - is it allocated a numerical relative identifier (RID). This is - slightly different to UNIX which has a range of numbers that are - used to identify users, and the same range in which to identify - groups. It is winbind's job to convert RIDs to UNIX id numbers and - vice versa. When winbind is configured it is given part of the UNIX - user id space and a part of the UNIX group id space in which to - store Windows NT users and groups. If a Windows NT user is - resolved for the first time, it is allocated the next UNIX id from - the range. The same process applies for Windows NT groups. Over - time, winbind will have mapped all Windows NT users and groups - to UNIX user ids and group ids.

    17.1.2.1. Registry Tattoos

    The results of this mapping are stored persistently in - an ID mapping database held in a tdb database). This ensures that - RIDs are mapped to UNIX IDs in a consistent way.

    With NT4 style registry based policy changes, a large number of settings are not +automatically reversed as the user logs off. Since the settings that were in the +NTConfig.POL file were applied to the client machine registry and that apply to the +hive key HKEY_LOCAL_MACHINE are permanent until explicitly reveresd. This is known +as tattooing. It can have serious consequences down-stream and the administrator must +be extreemly careful not to lock out the ability to manage the machine at a later date.


    16.4.6. Result Caching17.1.3. Creating and Managing MS Windows 200x Policies

    An active system can generate a lot of user and group - name lookups. To reduce the network cost of these lookups winbind - uses a caching scheme based on the SAM sequence number supplied - by NT domain controllers. User or group information returned - by a PDC is cached by winbind along with a sequence number also - returned by the PDC. This sequence number is incremented by - Windows NT whenever any user or group information is modified. If - a cached entry has expired, the sequence number is requested from - the PDC and compared against the sequence number of the cached entry. - If the sequence numbers do not match, then the cached information - is discarded and up to date information is requested directly - from the PDC.


    16.5. Installation and Configuration

    Windows NT4 System policies allows setting of registry parameters specific to +users, groups and computers (client workstations) that are members of the NT4 +style domain. Such policy file will work with MS Windows 2000 / XP clients also.

    Many thanks to John Trostel jtrostel@snapserver.comNew to MS Windows 2000 Microsoft introduced a new style of group policy that confers +a superset of capabilities compared with NT4 style policies. Obviously, the tool used +to create them is different, and the mechanism for implementing them is much changed.

    The older NT4 style registry based policies are known as Administrative Templates -for providing the HOWTO for this section.

    My Documents files (directory), as +well as intrinsics of where menu items will appear in the Start menu). An additional new +feature is the ability to make available particular software Windows applications to particular +users and/or groups.

    This HOWTO describes how to get winbind services up and running -to control access and authenticate users on your Linux box using -the winbind services which come with SAMBA 2.2.2.

    Remember: NT4 policy files are named NTConfig.POL and are stored in the root +of the NETLOGON share on the domain controllers. A Windows NT4 user enters a username, a password +and selects the domain name to which the logon will attempt to take place. During the logon +process the client machine reads the NTConfig.POL file from the NETLOGON share on the authenticating +server, modifies the local registry values according to the settings in this file.

    Windows 2K GPOs are very feature rich. They are NOT stored in the NETLOGON share, rather part of +a Windows 200x policy file is stored in the Active Directory itself and the other part is stored +in a shared (and replicated) volume called the SYSVOL folder. This folder is present on all Active +Directory domain controllers. The part that is stored in the Active Directory itself is called the +group policy container (GPC), and the part that is stored in the replicated share called SYSVOL is +known as the group policy template (GPT).

    With NT4 clients the policy file is read and executed upon only aas each user log onto the network. +MS Windows 200x policies are much more complex - GPOs are processed and applied at client machine +startup (machine specific part) and when the user logs onto the network the user specific part +is applied. In MS Windows 200x style policy management each machine and/or user may be subject +to any number of concurently applicable (and applied) policy sets (GPOs). Active Directory allows +the administrator to also set filters over the policy settings. No such equivalent capability +exists with NT4 style policy files.



    16.5.1. Introduction

    This HOWTO describes the procedures used to get winbind up and -running on my RedHat 7.1 system. Winbind is capable of providing access -and authentication control for Windows Domain users through an NT -or Win2K PDC for 'regular' services, such as telnet a nd ftp, as -well for SAMBA services.

    17.1.3.1. Administration of Win2K Policies

    This HOWTO has been written from a 'RedHat-centric' perspective, so if -you are using another distribution, you may have to modify the instructions -somewhat to fit the way your distribution works.

    Instead of using the tool called "The System Policy Editor", commonly called Poledit (from the +executable name poledit.exe), GPOs are created and managed using a Microsoft Management Console +(MMC) snap-in as follows:

    • Why should I to this? Go to the Windows 200x / XP menu Start->Programs->Adminsitrative Tools + and select the MMC snap-in called "Active Directory Users and Computers"

      This allows the SAMBA administrator to rely on the - authentication mechanisms on the NT/Win2K PDC for the authentication - of domain members. NT/Win2K users no longer need to have separate - accounts on the SAMBA server. +>

    • Select the domain or organizational unit (OU) that you wish to manage, then right click + to open the context menu for that object, select the properties item.

    • Who should be reading this document? +> Now left click on the Group Policy tab, then left click on the New tab. Type a name + for the new policy you will create.

    • This HOWTO is designed for system administrators. If you are - implementing SAMBA on a file server and wish to (fairly easily) - integrate existing NT/Win2K users from your PDC onto the - SAMBA server, this HOWTO is for you. That said, I am no NT or PAM - expert, so you may find a better or easier way to accomplish - these tasks. +> Now left click on the Edit tab to commence the steps needed to create the GPO.

    All policy configuration options are controlled through the use of policy administrative +templates. These files have a .adm extension, both in NT4 as well as in Windows 200x / XP. +Beware however, since the .adm files are NOT interchangible across NT4 and Windows 200x. +The later introduces many new features as well as extended definition capabilities. It is +well beyond the scope of this documentation to explain how to program .adm files, for that +the adminsitrator is referred to the Microsoft Windows Resource Kit for your particular +version of MS Windows.

    The MS Windows 2000 Resource Kit contains a tool called gpolmig.exe. This tool can be used +to migrate an NT4 NTConfig.POL file into a Windows 200x style GPO. Be VERY careful how you +use this powerful tool. Please refer to the resource kit manuals for specific usage information.



    16.5.2. Requirements

    Chapter 18. Profile Management

    18.1. Roaming Profiles

    If you have a samba configuration file that you are currently -using... BACK IT UP! If your system already uses PAM, -back up the /etc/pam.d directory -contents! If you haven't already made a boot disk, -

    MAKE ONE NOW!NOTE! Roaming profiles support is different for Win9X and WinNT.

    Before discussing how to configure roaming profiles, it is useful to see how +Win9X and WinNT clients implement these features.

    Win9X clients send a NetUserGetInfo request to the server to get the user's +profiles location. However, the response does not have room for a separate +profiles location field, only the user's home share. This means that Win9X +profiles are restricted to being in the user's home directory.

    WinNT clients send a NetSAMLogon RPC request, which contains many fields, +including a separate field for the location of the user's profiles. +This means that support for profiles is different for Win9X and WinNT.


    18.1.1. Windows NT Configuration

    To support WinNT clients, in the [global] section of smb.conf set the +following (for example):

    logon path = \\profileserver\profileshare\profilepath\%U\moreprofilepath

    Messing with the pam configuration files can make it nearly impossible -to log in to yourmachine. That's why you want to be able to boot back -into your machine in single user mode and restore your -/etc/pam.d back to the original state they were in if -you get frustrated with the way things are going. ;-)

    The default for this option is \\%N\%U\profile, namely +\\sambaserver\username\profile. The \\N%\%U service is created +automatically by the [homes] service. +If you are using a samba server for the profiles, you _must_ make the +share specified in the logon path browseable.

    The latest version of SAMBA (version 3.0 as of this writing), now -includes a functioning winbindd daemon. Please refer to the -main SAMBA web page or, -better yet, your closest SAMBA mirror site for instructions on -downloading the source code.

    To allow Domain users the ability to access SAMBA shares and -files, as well as potentially other services provided by your -SAMBA machine, PAM (pluggable authentication modules) must -be setup properly on your machine. In order to compile the -winbind modules, you should have at least the pam libraries resident -on your system. For recent RedHat systems (7.1, for instance), that -means pam-0.74-22. For best results, it is helpful to also -install the development packages in pam-devel-0.74-22.

    MS Windows NT/2K clients at times do not disconnect a connection to a server +between logons. It is recommended to NOT use the homes +meta-service name as part of the profile share path.


    16.5.3. Testing Things Out18.1.2. Windows 9X Configuration

    Before starting, it is probably best to kill off all the SAMBA -related daemons running on your server. Kill off all smbd, -nmbd, and winbindd processes that may -be running. To use PAM, you will want to make sure that you have the -standard PAM package (for RedHat) which supplies the /etc/pam.d -directory structure, including the pam modules are used by pam-aware -services, several pam libraries, and the /usr/doc -and /usr/man entries for pam. Winbind built better -in SAMBA if the pam-devel package was also installed. This package includes -the header files needed to compile pam-aware applications. For instance, -my RedHat system has both pam-0.74-22 and -pam-devel-0.74-22 RPMs installed.

    To support Win9X clients, you must use the "logon home" parameter. Samba has +now been fixed so that "net use /home" now works as well, and it, too, relies +on the "logon home" parameter.

    By using the logon home parameter, you are restricted to putting Win9X +profiles in the user's home directory. But wait! There is a trick you +can use. If you set the following in the [global] section of your +smb.conf file:

    logon home = \\%L\%U\.profiles

    then your Win9X clients will dutifully put their clients in a subdirectory +of your home directory called .profiles (thus making them hidden).

    Not only that, but 'net use/home' will also work, because of a feature in +Win9X. It removes any directory stuff off the end of the home directory area +and only uses the server and share portion. That is, it looks like you +specified \\%L\%U for "logon home".



    16.5.3.1. Configure and compile SAMBA

    18.1.3. Win9X and WinNT Configuration

    The configuration and compilation of SAMBA is pretty straightforward. -The first three steps may not be necessary depending upon -whether or not you have previously built the Samba binaries.

    You can support profiles for both Win9X and WinNT clients by setting both the +"logon home" and "logon path" parameters. For example:

    root# autoconf
    -root# make clean
    -root# rm config.cache
    -root# ./configure
    -root# make
    -root# make install
    logon home = \\%L\%U\.profiles +logon path = \\%L\profiles\%U

    This will, by default, install SAMBA in /usr/local/samba. -See the main SAMBA documentation if you want to install SAMBA somewhere else. -It will also build the winbindd executable and libraries.

    I have not checked what 'net use /home' does on NT when "logon home" is +set as above.



    16.5.3.2. Configure nsswitch.conf and the -winbind libraries

    18.1.4. Windows 9X Profile Setup

    The libraries needed to run the winbindd daemon -through nsswitch need to be copied to their proper locations, so

    When a user first logs in on Windows 9X, the file user.DAT is created, +as are folders "Start Menu", "Desktop", "Programs" and "Nethood". +These directories and their contents will be merged with the local +versions stored in c:\windows\profiles\username on subsequent logins, +taking the most recent from each. You will need to use the [global] +options "preserve case = yes", "short preserve case = yes" and +"case sensitive = no" in order to maintain capital letters in shortcuts +in any of the profile folders.

    The user.DAT file contains all the user's preferences. If you wish to +enforce a set of preferences, rename their user.DAT file to user.MAN, +and deny them write access to this file.

    root# cp ../samba/source/nsswitch/libnss_winbind.so /lib

    1. On the Windows 95 machine, go to Control Panel | Passwords and + select the User Profiles tab. Select the required level of + roaming preferences. Press OK, but do _not_ allow the computer + to reboot. +

    2. On the Windows 95 machine, go to Control Panel | Network | + Client for Microsoft Networks | Preferences. Select 'Log on to + NT Domain'. Then, ensure that the Primary Logon is 'Client for + Microsoft Networks'. Press OK, and this time allow the computer + to reboot. +

    Under Windows 95, Profiles are downloaded from the Primary Logon. +If you have the Primary Logon as 'Client for Novell Networks', then +the profiles and logon script will be downloaded from your Novell +Server. If you have the Primary Logon as 'Windows Logon', then the +profiles will be loaded from the local machine - a bit against the +concept of roaming profiles, if you ask me.

    You will now find that the Microsoft Networks Login box contains +[user, password, domain] instead of just [user, password]. Type in +the samba server's domain name (or any other domain known to exist, +but bear in mind that the user will be authenticated against this +domain and profiles downloaded from it, if that domain logon server +supports it), user name and user's password.

    Once the user has been successfully validated, the Windows 95 machine +will inform you that 'The user has not logged on before' and asks you +if you wish to save the user's preferences? Select 'yes'.

    Once the Windows 95 client comes up with the desktop, you should be able +to examine the contents of the directory specified in the "logon path" +on the samba server and verify that the "Desktop", "Start Menu", +"Programs" and "Nethood" folders have been created.

    These folders will be cached locally on the client, and updated when +the user logs off (if you haven't made them read-only by then :-). +You will find that if the user creates further folders or short-cuts, +that the client will merge the profile contents downloaded with the +contents of the profile directory already on the local client, taking +the newest folders and short-cuts from each set.

    If you have made the folders / files read-only on the samba server, +then you will get errors from the w95 machine on logon and logout, as +it attempts to merge the local and the remote profile. Basically, if +you have any errors reported by the w95 machine, check the Unix file +permissions and ownership rights on the profile directory contents, +on the samba server.

    I also found it necessary to make the following symbolic link:

    If you have problems creating user profiles, you can reset the user's +local desktop cache, as shown below. When this user then next logs in, +they will be told that they are logging in "for the first time".

    root# ln -s /lib/libnss_winbind.so /lib/libnss_winbind.so.2

    1. And, in the case of Sun solaris:

      instead of logging in under the [user, password, domain] dialog, + press escape. +

    2. root# ln -s /usr/lib/libnss_winbind.so /usr/lib/libnss_winbind.so.1 -root# ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.1 -root# ln -s /usr/lib/libnss_winbind.so /usr/lib/nss_winbind.so.2

      run the regedit.exe program, and look in: +

      Now, as root you need to edit /etc/nsswitch.conf to -allow user and group entries to be visible from the winbindd -daemon. My /etc/nsswitch.conf file look like -this after editing:

      HKEY_LOCAL_MACHINE\Windows\CurrentVersion\ProfileList +

      	passwd:     files winbind
      -	shadow:     files 
      -	group:      files winbind

      you will find an entry, for each user, of ProfilePath. Note the + contents of this key (likely to be c:\windows\profiles\username), + then delete the key ProfilePath for the required user. +

      -The libraries needed by the winbind daemon will be automatically -entered into the ldconfig cache the next time -your system reboots, but it -is faster (and you don't need to reboot) if you do it manually:

      [Exit the registry editor]. +

    3. root# /sbin/ldconfig -v | grep winbind

      WARNING - before deleting the contents of the + directory listed in + the ProfilePath (this is likely to be c:\windows\profiles\username), + ask them if they have any important files stored on their desktop + or in their start menu. delete the contents of the directory + ProfilePath (making a backup if any of the files are needed). +

      This makes libnss_winbind available to winbindd -and echos back a check to you.


    16.5.3.3. Configure smb.conf

    This will have the effect of removing the local (read-only hidden + system file) user.DAT in their profile directory, as well as the + local "desktop", "nethood", "start menu" and "programs" folders. +

  • Several parameters are needed in the smb.conf file to control -the behavior of winbindd. Configure -smb.conf These are described in more detail in -the winbindd(8) man page. My -smb.conf file was modified to -include the following entries in the [global] section:

    search for the user's .PWL password-caching file in the c:\windows + directory, and delete it. +

  • [global]
    -     <...>
    -     # separate domain and username with '+', like DOMAIN+username
    -     winbind separator = +
    -     # use uids from 10000 to 20000 for domain users
    -     winbind uid = 10000-20000
    -     # use gids from 10000 to 20000 for domain groups
    -     winbind gid = 10000-20000
    -     # allow enumeration of winbind users and groups
    -     winbind enum users = yes
    -     winbind enum groups = yes
    -     # give winbind users a real shell (only needed if they have telnet access)
    -     template homedir = /home/winnt/%D/%U
    -     template shell = /bin/bash


  • 16.5.3.4. Join the SAMBA server to the PDC domain

    log off the windows 95 client. +

  • Enter the following command to make the SAMBA server join the -PDC domain, where DOMAIN is the name of -your Windows domain and Administrator is -a domain user who has administrative privileges in the domain.

    check the contents of the profile path (see "logon path" described + above), and delete the user.DAT or user.MAN file for the user, + making a backup if required. +

  • root# /usr/local/samba/bin/net join -S PDC -U Administrator

    If all else fails, increase samba's debug log levels to between 3 and 10, +and / or run a packet trace program such as tcpdump or netmon.exe, and +look for any error reports.

    The proper response to the command should be: "Joined the domain -DOMAIN" where DOMAIN -is your DOMAIN name.

    If you have access to an NT server, then first set up roaming profiles +and / or netlogons on the NT server. Make a packet trace, or examine +the example packet traces provided with NT server, and see what the +differences are with the equivalent samba trace.



    16.5.3.5. Start up the winbindd daemon and test it!

    Eventually, you will want to modify your smb startup script to -automatically invoke the winbindd daemon when the other parts of -SAMBA start, but it is possible to test out just the winbind -portion first. To start up winbind services, enter the following -command as root:

    root# /usr/local/samba/bin/winbindd

    Winbindd can now also run in 'dual daemon mode'. This will make it -run as 2 processes. The first will answer all requests from the cache, -thus making responses to clients faster. The other will -update the cache for the query that the first has just responded. -Advantage of this is that responses stay accurate and are faster. -You can enable dual daemon mode by adding '-B' to the commandline:

    root# /usr/local/samba/bin/winbindd -B

    18.1.5. Windows NT Workstation 4.0

    I'm always paranoid and like to make sure the daemon -is really running...

    When a user first logs in to a Windows NT Workstation, the profile +NTuser.DAT is created. The profile location can be now specified +through the "logon path" parameter.

    root# ps -ae | grep winbindd

    There is a parameter that is now available for use with NT Profiles: +"logon drive". This should be set to "h:" or any other drive, and +should be used in conjunction with the new "logon home" parameter.

    This command should produce output like this, if the daemon is running

    The entry for the NT 4.0 profile is a _directory_ not a file. The NT +help on profiles mentions that a directory is also created with a .PDS +extension. The user, while logging in, must have write permission to +create the full profile path (and the folder with the .PDS extension +for those situations where it might be created.)

    3025 ? 00:00:00 winbindd

    In the profile directory, NT creates more folders than 95. It creates +"Application Data" and others, as well as "Desktop", "Nethood", +"Start Menu" and "Programs". The profile itself is stored in a file +NTuser.DAT. Nothing appears to be stored in the .PDS directory, and +its purpose is currently unknown.

    Now... for the real test, try to get some information about the -users on your PDC

    You can use the System Control Panel to copy a local profile onto +a samba server (see NT Help on profiles: it is also capable of firing +up the correct location in the System Control Panel for you). The +NT Help file also mentions that renaming NTuser.DAT to NTuser.MAN +turns a profile into a mandatory one.

    root# /usr/local/samba/bin/wbinfo -u

    The case of the profile is significant. The file must be called +NTuser.DAT or, for a mandatory profile, NTuser.MAN.


    18.1.6. Windows NT/200x Server

    -This should echo back a list of users on your Windows users on -your PDC. For example, I get the following response:

    There is nothing to stop you specifying any path that you like for the +location of users' profiles. Therefore, you could specify that the +profile be stored on a samba server, or any other SMB server, as long as +that SMB server supports encrypted passwords.


    18.1.7. Sharing Profiles between W9x/Me and NT4/200x/XP workstations

    CEO+Administrator
    -CEO+burdell
    -CEO+Guest
    -CEO+jt-ad
    -CEO+krbtgt
    -CEO+TsInternetUser

    Sharing of desktop profiles between Windows versions is NOT recommended. +Desktop profiles are an evolving phenomenon and profiles for later versions +of MS Windows clients add features that may interfere with earlier versions +of MS Windows clients. Probably the more salient reason to NOT mix profiles +is that when logging off an earlier version of MS Windows the older format +of profile contents may overwrite information that belongs to the newer +version resulting in loss of profile information content when that user logs +on again with the newer version of MS Windows.

    Obviously, I have named my domain 'CEO' and my winbind -separator is '+'.

    If you then want to share the same Start Menu / Desktop with W9x/Me, you will +need to specify a common location for the profiles. The smb.conf parameters +that need to be common are logon path and +logon home.

    You can do the same sort of thing to get group information from -the PDC:

    If you have this set up correctly, you will find separate user.DAT and +NTuser.DAT files in the same profile directory.


    18.1.8. Windows NT 4

    root# /usr/local/samba/bin/wbinfo -g
    -CEO+Domain Admins
    -CEO+Domain Users
    -CEO+Domain Guests
    -CEO+Domain Computers
    -CEO+Domain Controllers
    -CEO+Cert Publishers
    -CEO+Schema Admins
    -CEO+Enterprise Admins
    -CEO+Group Policy Creator Owners

    Unfortunately, the Resource Kit info is Win NT4 or 200x specific.

    The function 'getent' can now be used to get unified -lists of both local and PDC users and groups. -Try the following command:

    Here is a quick guide:

    root# getent passwd

    • You should get a list that looks like your /etc/passwd -list followed by the domain users with their new uids, gids, home -directories and default shells.

      The same thing can be done for groups with the command

      On your NT4 Domain Controller, right click on 'My Computer', then +select the tab labelled 'User Profiles'.

    • root# getent group


    16.5.3.6. Fix the init.d startup scripts

    Select a user profile you want to migrate and click on it.

    16.5.3.6.1. Linux

    The winbindd daemon needs to start up after the -smbd and nmbd daemons are running. -To accomplish this task, you need to modify the startup scripts of your system. They are located at /etc/init.d/smb in RedHat and -/etc/init.d/samba in Debian. -script to add commands to invoke this daemon in the proper sequence. My -startup script starts up smbd, -nmbd, and winbindd from the -/usr/local/samba/bin directory directly. The 'start' -function in the script looks like this:

    start() {
    -        KIND="SMB"
    -        echo -n $"Starting $KIND services: "
    -        daemon /usr/local/samba/bin/smbd $SMBDOPTIONS
    -        RETVAL=$?
    -        echo
    -        KIND="NMB"
    -        echo -n $"Starting $KIND services: "
    -        daemon /usr/local/samba/bin/nmbd $NMBDOPTIONS
    -        RETVAL2=$?
    -        echo
    -        KIND="Winbind"
    -        echo -n $"Starting $KIND services: "
    -        daemon /usr/local/samba/bin/winbindd
    -        RETVAL3=$?
    -        echo
    -        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && touch /var/lock/subsys/smb || \
    -           RETVAL=1
    -        return $RETVAL
    -}
    I am using the term "migrate" lossely. You can copy a profile to +create a group profile. You can give the user 'Everyone' rights to the +profile you copy this to. That is what you need to do, since your samba +domain is not a member of a trust relationship with your NT4 PDC.

  • Click the 'Copy To' button.

  • In the box labelled 'Copy Profile to' add your new path, eg: +c:\temp\foobar

  • If you would like to run winbindd in dual daemon mode, replace -the line -

            daemon /usr/local/samba/bin/winbindd
    - -in the example above with: - -
            daemon /usr/local/samba/bin/winbindd -B
    .

    Click on the button labelled 'Change' in the "Permitted to use" box.

  • The 'stop' function has a corresponding entry to shut down the -services and looks like this:

    Click on the group 'Everyone' and then click OK. This closes the +'chose user' box.

  • stop() {
    -        KIND="SMB"
    -        echo -n $"Shutting down $KIND services: "
    -        killproc smbd
    -        RETVAL=$?
    -        echo
    -        KIND="NMB"
    -        echo -n $"Shutting down $KIND services: "
    -        killproc nmbd
    -        RETVAL2=$?
    -        echo
    -        KIND="Winbind"
    -        echo -n $"Shutting down $KIND services: "
    -        killproc winbindd
    -        RETVAL3=$?
    -        [ $RETVAL -eq 0 -a $RETVAL2 -eq 0 -a $RETVAL3 -eq 0 ] && rm -f /var/lock/subsys/smb
    -        echo ""
    -        return $RETVAL
    -}

  • Now click OK.

    Follow the above for every profile you need to migrate.



    16.5.3.6.2. Solaris

    On solaris, you need to modify the -/etc/init.d/samba.server startup script. It usually -only starts smbd and nmbd but should now start winbindd too. If you -have samba installed in /usr/local/samba/bin, -the file could contains something like this:

    18.1.8.1. Side bar Notes

    ##
    -## samba.server
    -##
    -
    -if [ ! -d /usr/bin ]
    -then                    # /usr not mounted
    -        exit
    -fi
    -
    -killproc() {            # kill the named process(es)
    -        pid=`/usr/bin/ps -e |
    -             /usr/bin/grep -w $1 |
    -             /usr/bin/sed -e 's/^  *//' -e 's/ .*//'`
    -        [ "$pid" != "" ] && kill $pid
    -}
    - 
    -# Start/stop processes required for samba server
    -
    -case "$1" in
    -
    -'start')
    -#
    -# Edit these lines to suit your installation (paths, workgroup, host)
    -#
    -echo Starting SMBD
    -   /usr/local/samba/bin/smbd -D -s \
    -	/usr/local/samba/smb.conf
    -
    -echo Starting NMBD
    -   /usr/local/samba/bin/nmbd -D -l \
    -	/usr/local/samba/var/log -s /usr/local/samba/smb.conf
    -
    -echo Starting Winbind Daemon
    -   /usr/local/samba/bin/winbindd
    -   ;;
    -
    -'stop')
    -   killproc nmbd
    -   killproc smbd
    -   killproc winbindd
    -   ;;
    -
    -*)
    -   echo "Usage: /etc/init.d/samba.server { start | stop }"
    -   ;;
    -esac

    You should obtain the SID of your NT4 domain. You can use smbpasswd to do +this. Read the man page.

    Again, if you would like to run samba in dual daemon mode, replace -

       /usr/local/samba/bin/winbindd
    - -in the script above with: - -
       /usr/local/samba/bin/winbindd -B

    With Samba-3.0.0 alpha code you can import all you NT4 domain accounts +using the net samsync method. This way you can retain your profile +settings as well as all your users.



    16.5.3.6.3. Restarting

    18.1.8.2. Mandatory profiles

    If you restart the smbd, nmbd, -and winbindd daemons at this point, you -should be able to connect to the samba server as a domain member just as -if you were a local user.

    The above method can be used to create mandatory profiles also. To convert +a group profile into a mandatory profile simply locate the NTUser.DAT file +in the copied profile and rename it to NTUser.MAN.


    16.5.3.7. Configure Winbind and PAM18.1.8.3. moveuser.exe

    If you have made it this far, you know that winbindd and samba are working -together. If you want to use winbind to provide authentication for other -services, keep reading. The pam configuration files need to be altered in -this step. (Did you remember to make backups of your original -/etc/pam.d files? If not, do it now.)

    You will need a pam module to use winbindd with these other services. This -module will be compiled in the ../source/nsswitch directory -by invoking the command

    The W2K professional resource kit has moveuser.exe. moveuser.exe changes +the security of a profile from one user to another. This allows the account +domain to change, and/or the user name to change.


    18.1.8.4. Get SID

    root# make nsswitch/pam_winbind.so

    You can identify the SID by using GetSID.exe from the Windows NT Server 4.0 +Resource Kit.

    from the ../source directory. The -pam_winbind.so file should be copied to the location of -your other pam security modules. On my RedHat system, this was the -/lib/security directory. On Solaris, the pam security -modules reside in /usr/lib/security.

    Windows NT 4.0 stores the local profile information in the registry under +the following key: +HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

    root# cp ../samba/source/nsswitch/pam_winbind.so /lib/security

    Under the ProfileList key, there will be subkeys named with the SIDs of the +users who have logged on to this computer. (To find the profile information +for the user whose locally cached profile you want to move, find the SID for +the user with the GetSID.exe utility.) Inside of the appropriate user's +subkey, you will see a string value named ProfileImagePath.



    16.5.3.7.1. Linux/FreeBSD-specific PAM configuration

    18.1.9. Windows 2000/XP

    The /etc/pam.d/samba file does not need to be changed. I -just left this fileas it was:

    You must first convert the profile from a local profile to a domain +profile on the MS Windows workstation as follows:

    auth    required        /lib/security/pam_stack.so service=system-auth
    -account required        /lib/security/pam_stack.so service=system-auth

    • The other services that I modified to allow the use of winbind -as an authentication service were the normal login on the console (or a terminal -session), telnet logins, and ftp service. In order to enable these -services, you may first need to change the entries in -/etc/xinetd.d (or /etc/inetd.conf). -RedHat 7.1 uses the new xinetd.d structure, in this case you need -to change the lines in /etc/xinetd.d/telnet -and /etc/xinetd.d/wu-ftp from

      enable = no

      Log on as the LOCAL workstation administrator.

    • to

      Right click on the 'My Computer' Icon, select 'Properties'

    • enable = yes

      Click on the 'User Profiles' tab

    • -For ftp services to work properly, you will also need to either -have individual directories for the domain users already present on -the server, or change the home directory template to a general -directory for all domain users. These can be easily set using -the smb.conf global entry -template homedir.

      Select the profile you wish to convert (click on it once)

    • The /etc/pam.d/ftp file can be changed -to allow winbind ftp access in a manner similar to the -samba file. My /etc/pam.d/ftp file was -changed to look like this:

      Click on the button 'Copy To'

    • auth       required     /lib/security/pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
      -auth       sufficient   /lib/security/pam_winbind.so
      -auth       required     /lib/security/pam_stack.so service=system-auth
      -auth       required     /lib/security/pam_shells.so
      -account    sufficient   /lib/security/pam_winbind.so
      -account    required     /lib/security/pam_stack.so service=system-auth
      -session    required     /lib/security/pam_stack.so service=system-auth

      In the "Permitted to use" box, click on the 'Change' button.

    • The /etc/pam.d/login file can be changed nearly the -same way. It now looks like this:

      Click on the 'Look in" area that lists the machine name, when you click +here it will open up a selection box. Click on the domain to which the +profile must be accessible.

      auth       required     /lib/security/pam_securetty.so
      -auth       sufficient   /lib/security/pam_winbind.so
      -auth       sufficient   /lib/security/pam_unix.so use_first_pass
      -auth       required     /lib/security/pam_stack.so service=system-auth
      -auth       required     /lib/security/pam_nologin.so
      -account    sufficient   /lib/security/pam_winbind.so
      -account    required     /lib/security/pam_stack.so service=system-auth
      -password   required     /lib/security/pam_stack.so service=system-auth
      -session    required     /lib/security/pam_stack.so service=system-auth
      -session    optional     /lib/security/pam_console.so

      In this case, I added the auth sufficient /lib/security/pam_winbind.so -lines as before, but also added the required pam_securetty.so -above it, to disallow root logins over the network. I also added a -sufficient /lib/security/pam_unix.so use_first_pass -line after the winbind.so line to get rid of annoying -double prompts for passwords.

      You will need to log on if a logon box opens up. Eg: In the connect +as: MIDEARTH\root, password: mypassword.

    • The /etc/pam.conf needs to be changed. I changed this file so that my Domain -users can logon both locally as well as telnet.The following are the changes -that I made.You can customize the pam.conf file as per your requirements,but -be sure of those changes because in the worst case it will leave your system -nearly impossible to boot.

      To make the profile capable of being used by anyone select 'Everyone'

    • #
      -#ident	"@(#)pam.conf	1.14	99/09/16 SMI"
      -#
      -# Copyright (c) 1996-1999, Sun Microsystems, Inc.
      -# All Rights Reserved.
      -#
      -# PAM configuration
      -#
      -# Authentication management
      -#
      -login   auth required   /usr/lib/security/pam_winbind.so
      -login	auth required 	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass 
      -login	auth required 	/usr/lib/security/$ISA/pam_dial_auth.so.1 try_first_pass 
      -#
      -rlogin  auth sufficient /usr/lib/security/pam_winbind.so
      -rlogin  auth sufficient /usr/lib/security/$ISA/pam_rhosts_auth.so.1
      -rlogin	auth required 	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
      -#
      -dtlogin auth sufficient /usr/lib/security/pam_winbind.so
      -dtlogin	auth required 	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
      -#
      -rsh	auth required	/usr/lib/security/$ISA/pam_rhosts_auth.so.1
      -other   auth sufficient /usr/lib/security/pam_winbind.so
      -other	auth required	/usr/lib/security/$ISA/pam_unix.so.1 try_first_pass
      -#
      -# Account management
      -#
      -login   account sufficient      /usr/lib/security/pam_winbind.so
      -login	account requisite	/usr/lib/security/$ISA/pam_roles.so.1 
      -login	account required	/usr/lib/security/$ISA/pam_unix.so.1 
      -#
      -dtlogin account sufficient      /usr/lib/security/pam_winbind.so
      -dtlogin	account requisite	/usr/lib/security/$ISA/pam_roles.so.1 
      -dtlogin	account required	/usr/lib/security/$ISA/pam_unix.so.1 
      -#
      -other   account sufficient      /usr/lib/security/pam_winbind.so
      -other	account requisite	/usr/lib/security/$ISA/pam_roles.so.1 
      -other	account required	/usr/lib/security/$ISA/pam_unix.so.1 
      -#
      -# Session management
      -#
      -other	session required	/usr/lib/security/$ISA/pam_unix.so.1 
      -#
      -# Password management
      -#
      -#other   password sufficient     /usr/lib/security/pam_winbind.so
      -other	password required	/usr/lib/security/$ISA/pam_unix.so.1 
      -dtsession auth required	/usr/lib/security/$ISA/pam_unix.so.1
      -#
      -# Support for Kerberos V5 authentication (uncomment to use Kerberos)
      -#
      -#rlogin	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
      -#login	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
      -#dtlogin	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
      -#other	auth optional	/usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass
      -#dtlogin	account optional /usr/lib/security/$ISA/pam_krb5.so.1
      -#other	account optional /usr/lib/security/$ISA/pam_krb5.so.1
      -#other	session optional /usr/lib/security/$ISA/pam_krb5.so.1
      -#other	password optional /usr/lib/security/$ISA/pam_krb5.so.1 try_first_pass

      Click OK. The Selection box will close.

    • I also added a try_first_pass line after the winbind.so line to get rid of -annoying double prompts for passwords.

      Now click on the 'Ok' button to create the profile in the path you +nominated.

    Done. You now have a profile that can be editted using the samba-3.0.0 +profiles tool.

    Now restart your Samba and try connecting through your application that you -configured in the pam.conf.

    Under NT/2K the use of mandotory profiles forces the use of MS Exchange +storage of mail data. That keeps desktop profiles usable.


    16.6. Limitations

    Winbind has a number of limitations in its current - released version that we hope to overcome in future - releases:

    • Winbind is currently only available for - the Linux, Solaris and IRIX operating systems, although ports to other operating - systems are certainly possible. For such ports to be feasible, - we require the C library of the target operating system to - support the Name Service Switch and Pluggable Authentication - Modules systems. This is becoming more common as NSS and - PAM gain support among UNIX vendors.

      This is a security check new to Windows XP (or maybe only +Windows XP service pack 1). It can be disabled via a group policy in +Active Directory. The policy is:

      "Computer Configuration\Administrative Templates\System\User +Profiles\Do not check for user ownership of Roaming Profile Folders"

      ...and it should be set to "Enabled". +Does the new version of samba have an Active Directory analogue? If so, +then you may be able to set the policy through this.

      If you cannot set group policies in samba, then you may be able to set +the policy locally on each machine. If you want to try this, then do +the following (N.B. I don't know for sure that this will work in the +same way as a domain group policy):

    • The mappings of Windows NT RIDs to UNIX ids - is not made algorithmically and depends on the order in which - unmapped users or groups are seen by winbind. It may be difficult - to recover the mappings of rid to UNIX id mapping if the file - containing this information is corrupted or destroyed.

      On the XP workstation log in with an Administrator account.

    • Currently the winbind PAM module does not take - into account possible workstation and logon time restrictions - that may be been set for Windows NT users, this is - instead up to the PDC to enforce.

      Click: "Start", "Run"

    • Type: "mmc"

    • Click: "OK"

    • A Microsoft Management Console should appear.

    • Click: File, "Add/Remove Snap-in...", "Add"

    • Double-Click: "Group Policy"

    • Click: "Finish", "Close"

    • Click: "OK"

    • In the "Console Root" window:

    • Expand: "Local Computer Policy", "Computer Configuration",

    • "Administrative Templates", "System", "User Profiles"

    • Double-Click: "Do not check for user ownership of Roaming Profile

    • Folders"

    • Select: "Enabled"

    • Click: OK"

    • Close the whole console. You do not need to save the settings (this +refers to the console settings rather than the policies you have +changed).

    • Reboot


    16.7. Conclusion

    The winbind system, through the use of the Name Service - Switch, Pluggable Authentication Modules, and appropriate - Microsoft RPC calls have allowed us to provide seamless - integration of Microsoft Windows NT domain users on a - UNIX system. The result is a great reduction in the administrative - cost of running a mixed UNIX and NT network.

    Chapter 17. Integrating MS Windows networks with SambaChapter 19. Integrating MS Windows networks with Samba

    This section deals with NetBIOS over TCP/IP name to IP address resolution. If you your MS Windows clients are NOT configured to use NetBIOS over TCP/IP then this @@ -14743,8 +14914,8 @@ CLASS="SECT1" >


    17.1. Name Resolution in a pure Unix/Linux world19.1. Name Resolution in a pure Unix/Linux world

    The key configuration files covered in this section are:


    17.1.1. 19.1.1. /etc/hosts

    17.1.2. 19.1.2. /etc/resolv.conf

    17.1.3. 19.1.3. /etc/host.conf

    17.1.4. 19.1.4. /etc/nsswitch.conf

    17.2. Name resolution as used within MS Windows networking19.2. Name resolution as used within MS Windows networking

    MS Windows networking is predicated about the name each machine @@ -15087,8 +15258,8 @@ CLASS="SECT2" >


    17.2.1. The NetBIOS Name Cache19.2.1. The NetBIOS Name Cache

    All MS Windows machines employ an in memory buffer in which is @@ -15114,8 +15285,8 @@ CLASS="SECT2" >


    17.2.2. The LMHOSTS file19.2.2. The LMHOSTS file

    This file is usually located in MS Windows NT 4.0 or @@ -15217,8 +15388,8 @@ CLASS="SECT2" >


    17.2.3. HOSTS file19.2.3. HOSTS file

    This file is usually located in MS Windows NT 4.0 or 2000 in @@ -15239,8 +15410,8 @@ CLASS="SECT2" >


    17.2.4. DNS Lookup19.2.4. DNS Lookup

    This capability is configured in the TCP/IP setup area in the network @@ -15259,8 +15430,8 @@ CLASS="SECT2" >


    17.2.5. WINS Lookup19.2.5. WINS Lookup

    A WINS (Windows Internet Name Server) service is the equivaent of the @@ -15302,14 +15473,14 @@ CLASS="CHAPTER" >Chapter 18. Improved browsing in samba

    Chapter 20. Improved browsing in samba

    18.1. Overview of browsing20.1. Overview of browsing

    SMB networking provides a mechanism by which clients can access a list @@ -15337,8 +15508,8 @@ CLASS="SECT1" >


    18.2. Browsing support in samba20.2. Browsing support in samba

    Samba facilitates browsing. The browsing is supported by nmbd @@ -15380,8 +15551,8 @@ CLASS="SECT1" >


    18.3. Problem resolution20.3. Problem resolution

    If something doesn't work then hopefully the log.nmb file will help @@ -15427,8 +15598,8 @@ CLASS="SECT1" >


    18.4. Browsing across subnets20.4. Browsing across subnets

    Since the release of Samba 1.9.17(alpha1) Samba has been @@ -15458,8 +15629,8 @@ CLASS="SECT2" >


    18.4.1. How does cross subnet browsing work ?20.4.1. How does cross subnet browsing work ?

    Cross subnet browsing is a complicated dance, containing multiple @@ -15669,8 +15840,8 @@ CLASS="SECT1" >


    18.5. Setting up a WINS server20.5. Setting up a WINS server

    Either a Samba machine or a Windows NT Server machine may be set up @@ -15752,8 +15923,8 @@ CLASS="SECT1" >


    18.6. Setting up Browsing in a WORKGROUP20.6. Setting up Browsing in a WORKGROUP

    To set up cross subnet browsing on a network containing machines @@ -15837,8 +16008,8 @@ CLASS="SECT1" >


    18.7. Setting up Browsing in a DOMAIN20.7. Setting up Browsing in a DOMAIN

    If you are adding Samba servers to a Windows NT Domain then @@ -15888,8 +16059,8 @@ CLASS="SECT1" >


    18.8. Forcing samba to be the master20.8. Forcing samba to be the master

    Who becomes the "master browser" is determined by an election process @@ -15936,8 +16107,8 @@ CLASS="SECT1" >


    18.9. Making samba the domain master20.9. Making samba the domain master

    The domain master is responsible for collating the browse lists of @@ -16009,8 +16180,8 @@ CLASS="SECT1" >


    18.10. Note about broadcast addresses20.10. Note about broadcast addresses

    If your network uses a "0" based broadcast address (for example if it @@ -16023,8 +16194,8 @@ CLASS="SECT1" >


    18.11. Multiple interfaces20.11. Multiple interfaces

    Samba now supports machines with multiple network interfaces. If you @@ -16038,14 +16209,14 @@ CLASS="CHAPTER" >Chapter 19. Hosting a Microsoft Distributed File System tree on Samba

    Chapter 21. Hosting a Microsoft Distributed File System tree on Samba

    19.1. Instructions21.1. Instructions

    The Distributed File System (or Dfs) provides a means of @@ -16176,8 +16347,8 @@ CLASS="SECT2" >


    19.1.1. Notes21.1.1. Notes

    Chapter 20. Stackable VFS modulesChapter 22. Stackable VFS modules

    20.1. Introduction and configuration22.1. Introduction and configuration

    Since samba 3.0, samba supports stackable VFS(Virtual File System) modules. @@ -16258,16 +16429,16 @@ CLASS="SECT1" >


    20.2. Included modules22.2. Included modules

    20.2.1. audit22.2.1. audit

    A simple module to audit file access to the syslog @@ -16304,8 +16475,8 @@ CLASS="SECT2" >


    20.2.2. recycle22.2.2. recycle

    A recycle-bin like modules. When used any unlink call @@ -16375,8 +16546,8 @@ CLASS="SECT2" >


    20.2.3. netatalk22.2.3. netatalk

    A netatalk module, that will ease co-existence of samba and @@ -16408,8 +16579,8 @@ CLASS="SECT1" >


    20.3. VFS modules available elsewhere22.3. VFS modules available elsewhere

    This section contains a listing of various other VFS modules that @@ -16424,8 +16595,8 @@ CLASS="SECT2" >


    20.3.1. DatabaseFS22.3.1. DatabaseFS

    URL:


    20.3.2. vscan22.3.2. vscan

    URL: Chapter 21. Securing SambaChapter 23. Securing Samba

    21.1. Introduction23.1. Introduction

    This note was attached to the Samba 2.2.8 release notes as it contained an @@ -16501,8 +16672,8 @@ CLASS="SECT1" >


    21.2. Using host based protection23.2. Using host based protection

    In many installations of Samba the greatest threat comes for outside @@ -16533,8 +16704,8 @@ CLASS="SECT1" >


    21.3. Using interface protection23.3. Using interface protection

    By default Samba will accept connections on any network interface that @@ -16569,8 +16740,8 @@ CLASS="SECT1" >


    21.4. Using a firewall23.4. Using a firewall

    Many people use a firewall to deny access to services that they don't @@ -16599,8 +16770,8 @@ CLASS="SECT1" >


    21.5. Using a IPC$ share deny23.5. Using a IPC$ share deny

    If the above methods are not suitable, then you could also place a @@ -16638,8 +16809,8 @@ CLASS="SECT1" >


    21.6. Upgrading Samba23.6. Upgrading Samba

    Please check regularly on http://www.samba.org/ for updates and @@ -16654,14 +16825,14 @@ CLASS="CHAPTER" >Chapter 22. Unicode/CharsetsChapter 24. Unicode/Charsets

    22.1. What are charsets and unicode?24.1. What are charsets and unicode?

    Computers communicate in numbers. In texts, each number will be @@ -16710,8 +16881,8 @@ CLASS="SECT1" >


    22.2. Samba and charsets24.2. Samba and charsets

    As of samba 3.0, samba can (and will) talk unicode over the wire. Internally, @@ -16786,101 +16957,101 @@ CLASS="TOC" >Table of Contents

    23. 25. Samba performance issues
    23.1. 25.1. Comparisons
    23.2. 25.2. Socket options
    23.3. 25.3. Read size
    23.4. 25.4. Max xmit
    23.5. 25.5. Log level
    23.6. 25.6. Read raw
    23.7. 25.7. Write raw
    23.8. 25.8. Slow Clients
    23.9. 25.9. Slow Logins
    23.10. 25.10. Client tuning
    24. 26. Portability
    24.1. 26.1. HPUX
    24.2. 26.2. SCO Unix
    24.3. 26.3. DNIX
    24.4. 26.4. RedHat Linux Rembrandt-II
    24.5. 26.5. AIX
    24.5.1. 26.5.1. Sequential Read Ahead
    25. 27. Samba and other CIFS clients
    25.1. 27.1. Macintosh clients?
    25.2. 27.2. OS2 Client
    25.2.1. 27.2.1. How can I configure OS/2 Warp Connect or OS/2 Warp 4 as a client for Samba?
    25.2.2. 27.2.2. How can I configure OS/2 Warp 3 (not Connect), OS/2 1.2, 1.3 or 2.x for Samba?
    25.2.3. 27.2.3. Are there any other issues when OS/2 (any version) is used as a client?
    25.2.4. 27.2.4. How do I get printer driver download working for OS/2 clients?
    25.3. 27.3. Windows for Workgroups
    25.3.1. 27.3.1. Use latest TCP/IP stack from Microsoft
    25.3.2. 27.3.2. Delete .pwl files after password change
    25.3.3. 27.3.3. Configure WfW password handling
    25.3.4. 27.3.4. Case handling of passwords
    25.3.5. 27.3.5. Use TCP/IP as default protocol
    25.4. 27.4. Windows '95/'98
    25.5. 27.5. Windows 2000 Service Pack 2
    26. 28. How to compile SAMBA
    26.1. 28.1. Access Samba source code via CVS
    26.1.1. 28.1.1. Introduction
    26.1.2. 28.1.2. CVS Access to samba.org
    26.2. 28.2. Accessing the samba sources via rsync and ftp
    26.3. 28.3. Building the Binaries
    26.3.1. 28.3.1. Compiling samba with Active Directory support
    26.4. 28.4. Starting the smbd and nmbd
    26.4.1. 28.4.1. Starting from inetd.conf
    26.4.2. 28.4.2. Alternative: starting it as a daemon
    27. 29. Reporting Bugs
    27.1. 29.1. Introduction
    27.2. 29.2. General info
    27.3. 29.3. Debug levels
    27.4. 29.4. Internal errors
    27.5. 29.5. Attaching to a running process
    27.6. 29.6. Patches
    28. 30. The samba checklist
    28.1. 30.1. Introduction
    28.2. 30.2. Assumptions
    28.3. 30.3. Tests
    28.3.1. 30.3.1. Test 1
    28.3.2. 30.3.2. Test 2
    28.3.3. 30.3.3. Test 3
    28.3.4. 30.3.4. Test 4
    28.3.5. 30.3.5. Test 5
    28.3.6. 30.3.6. Test 6
    28.3.7. 30.3.7. Test 7
    28.3.8. 30.3.8. Test 8
    28.3.9. 30.3.9. Test 9
    28.3.10. 30.3.10. Test 10
    28.3.11. 30.3.11. Test 11
    28.4. 30.4. Still having troubles?
    Chapter 23. Samba performance issuesChapter 25. Samba performance issues

    23.1. Comparisons25.1. Comparisons

    The Samba server uses TCP to talk to the client. Thus if you are @@ -17217,8 +17388,8 @@ CLASS="SECT1" >


    23.2. Socket options25.2. Socket options

    There are a number of socket options that can greatly affect the @@ -17245,8 +17416,8 @@ CLASS="SECT1" >


    23.3. Read size25.3. Read size

    The option "read size" affects the overlap of disk reads/writes with @@ -17271,8 +17442,8 @@ CLASS="SECT1" >


    23.4. Max xmit25.4. Max xmit

    At startup the client and server negotiate a "maximum transmit" size, @@ -17294,8 +17465,8 @@ CLASS="SECT1" >


    23.5. Log level25.5. Log level

    If you set the log level (also known as "debug level") higher than 2 @@ -17308,8 +17479,8 @@ CLASS="SECT1" >


    23.6. Read raw25.6. Read raw

    The "read raw" operation is designed to be an optimised, low-latency @@ -17330,8 +17501,8 @@ CLASS="SECT1" >


    23.7. Write raw25.7. Write raw

    The "write raw" operation is designed to be an optimised, low-latency @@ -17347,8 +17518,8 @@ CLASS="SECT1" >


    23.8. Slow Clients25.8. Slow Clients

    One person has reported that setting the protocol to COREPLUS rather @@ -17364,8 +17535,8 @@ CLASS="SECT1" >


    23.9. Slow Logins25.9. Slow Logins

    Slow logins are almost always due to the password checking time. Using @@ -17377,8 +17548,8 @@ CLASS="SECT1" >


    23.10. Client tuning25.10. Client tuning

    Often a speed problem can be traced to the client. The client (for @@ -17485,7 +17656,7 @@ CLASS="CHAPTER" >Chapter 24. PortabilityChapter 26. Portability

    Samba works on a wide range of platforms but the interface all the platforms provide is not always compatible. This chapter contains @@ -17495,8 +17666,8 @@ CLASS="SECT1" >


    24.1. HPUX26.1. HPUX

    HP's implementation of supplementary groups is, er, non-standard (for @@ -17525,8 +17696,8 @@ CLASS="SECT1" >


    24.2. SCO Unix26.2. SCO Unix

    @@ -17542,8 +17713,8 @@ CLASS="SECT1" >


    24.3. DNIX26.3. DNIX

    DNIX has a problem with seteuid() and setegid(). These routines are @@ -17649,8 +17820,8 @@ CLASS="SECT1" >


    24.4. RedHat Linux Rembrandt-II26.4. RedHat Linux Rembrandt-II

    By default RedHat Rembrandt-II during installation adds an @@ -17673,16 +17844,16 @@ CLASS="SECT1" >


    24.5. AIX26.5. AIX

    24.5.1. Sequential Read Ahead26.5.1. Sequential Read Ahead

    Disabling Sequential Read Ahead using "vmtune -r 0" improves @@ -17696,7 +17867,7 @@ CLASS="CHAPTER" >Chapter 25. Samba and other CIFS clientsChapter 27. Samba and other CIFS clients

    This chapter contains client-specific information.


    25.1. Macintosh clients?27.1. Macintosh clients?

    Yes.


    25.2. OS2 Client27.2. OS2 Client

    25.2.1. How can I configure OS/2 Warp Connect or +NAME="AEN3644" +>27.2.1. How can I configure OS/2 Warp Connect or OS/2 Warp 4 as a client for Samba?


    25.2.2. How can I configure OS/2 Warp 3 (not Connect), +NAME="AEN3659" +>27.2.2. How can I configure OS/2 Warp 3 (not Connect), OS/2 1.2, 1.3 or 2.x for Samba?


    25.2.3. Are there any other issues when OS/2 (any version) +NAME="AEN3668" +>27.2.3. Are there any other issues when OS/2 (any version) is used as a client?


    25.2.4. How do I get printer driver download working +NAME="AEN3672" +>27.2.4. How do I get printer driver download working for OS/2 clients?


    25.3. Windows for Workgroups27.3. Windows for Workgroups

    25.3.1. Use latest TCP/IP stack from Microsoft27.3.1. Use latest TCP/IP stack from Microsoft

    Use the latest TCP/IP stack from microsoft if you use Windows @@ -17960,8 +18131,8 @@ CLASS="SECT2" >


    25.3.2. Delete .pwl files after password change27.3.2. Delete .pwl files after password change

    WfWg does a lousy job with passwords. I find that if I change my @@ -17980,8 +18151,8 @@ CLASS="SECT2" >


    25.3.3. Configure WfW password handling27.3.3. Configure WfW password handling

    There is a program call admincfg.exe @@ -17999,8 +18170,8 @@ CLASS="SECT2" >


    25.3.4. Case handling of passwords27.3.4. Case handling of passwords

    Windows for Workgroups uppercases the password before sending it to the server. Unix passwords can be case-sensitive though. Check the


    25.3.5. Use TCP/IP as default protocol27.3.5. Use TCP/IP as default protocol

    To support print queue reporting you may find @@ -18033,8 +18204,8 @@ CLASS="SECT1" >


    25.4. Windows '95/'9827.4. Windows '95/'98

    When using Windows 95 OEM SR2 the following updates are recommended where Samba @@ -18081,8 +18252,8 @@ CLASS="SECT1" >


    25.5. Windows 2000 Service Pack 227.5. Windows 2000 Service Pack 2

    @@ -18165,7 +18336,7 @@ CLASS="CHAPTER" >Chapter 26. How to compile SAMBAChapter 28. How to compile SAMBA

    You can obtain the samba source from the


    26.1. Access Samba source code via CVS28.1. Access Samba source code via CVS

    26.1.1. Introduction28.1.1. Introduction

    Samba is developed in an open environment. Developers use CVS @@ -18208,8 +18379,8 @@ CLASS="SECT2" >


    26.1.2. CVS Access to samba.org28.1.2. CVS Access to samba.org

    The machine samba.org runs a publicly accessible CVS @@ -18221,8 +18392,8 @@ CLASS="SECT3" >


    26.1.2.1. Access via CVSweb28.1.2.1. Access via CVSweb

    You can access the source code via your @@ -18242,8 +18413,8 @@ CLASS="SECT3" >


    26.1.2.2. Access via cvs28.1.2.2. Access via cvs

    You can also access the source code via a @@ -18347,8 +18518,8 @@ CLASS="SECT1" >


    26.2. Accessing the samba sources via rsync and ftp28.2. Accessing the samba sources via rsync and ftp

    pserver.samba.org also exports unpacked copies of most parts of the CVS tree at


    26.3. Building the Binaries28.3. Building the Binaries

    To do this, first run the program


    26.3.1. Compiling samba with Active Directory support28.3.1. Compiling samba with Active Directory support

    In order to compile samba with ADS support, you need to have installed @@ -18511,8 +18682,8 @@ CLASS="SECT3" >


    26.3.1.1. Installing the required packages for Debian28.3.1.1. Installing the required packages for Debian

    On Debian you need to install the following packages:


    26.3.1.2. Installing the required packages for RedHat28.3.1.2. Installing the required packages for RedHat

    On RedHat this means you should have at least:


    26.4. Starting the smbd and nmbd28.4. Starting the smbd and nmbd

    You must choose to start smbd and nmbd either @@ -18624,8 +18795,8 @@ CLASS="SECT2" >


    26.4.1. Starting from inetd.conf28.4.1. Starting from inetd.conf

    NOTE; The following will be different if @@ -18724,8 +18895,8 @@ CLASS="SECT2" >


    26.4.2. Alternative: starting it as a daemon28.4.2. Alternative: starting it as a daemon

    To start the server as a daemon you should create @@ -18783,14 +18954,14 @@ CLASS="CHAPTER" >Chapter 27. Reporting BugsChapter 29. Reporting Bugs

    27.1. Introduction29.1. Introduction

    The email address for bug reports for stable releases is


    27.2. General info29.2. General info

    Before submitting a bug report check your config for silly @@ -18859,8 +19030,8 @@ CLASS="SECT1" >


    27.3. Debug levels29.3. Debug levels

    If the bug has anything to do with Samba behaving incorrectly as a @@ -18929,8 +19100,8 @@ CLASS="SECT1" >


    27.4. Internal errors29.4. Internal errors

    If you get a "INTERNAL ERROR" message in your log files it means that @@ -18973,8 +19144,8 @@ CLASS="SECT1" >


    27.5. Attaching to a running process29.5. Attaching to a running process

    Unfortunately some unixes (in particular some recent linux kernels) @@ -18990,8 +19161,8 @@ CLASS="SECT1" >


    27.6. Patches29.6. Patches

    The best sort of bug report is one that includes a fix! If you send us @@ -19013,14 +19184,14 @@ CLASS="CHAPTER" >Chapter 28. The samba checklistChapter 30. The samba checklist

    28.1. Introduction30.1. Introduction

    This file contains a list of tests you can perform to validate your @@ -19041,8 +19212,8 @@ CLASS="SECT1" >


    28.2. Assumptions30.2. Assumptions

    In all of the tests it is assumed you have a Samba server called @@ -19079,16 +19250,16 @@ CLASS="SECT1" >


    28.3. Tests30.3. Tests

    28.3.1. Test 130.3.1. Test 1

    In the directory in which you store your smb.conf file, run the command @@ -19109,8 +19280,8 @@ CLASS="SECT2" >


    28.3.2. Test 230.3.2. Test 2

    Run the command "ping BIGSERVER" from the PC and "ping ACLIENT" from @@ -19135,8 +19306,8 @@ CLASS="SECT2" >


    28.3.3. Test 330.3.3. Test 3

    Run the command "smbclient -L BIGSERVER" on the unix box. You @@ -19206,8 +19377,8 @@ CLASS="SECT2" >


    28.3.4. Test 430.3.4. Test 4

    Run the command "nmblookup -B BIGSERVER __SAMBA__". You should get the @@ -19227,8 +19398,8 @@ CLASS="SECT2" >


    28.3.5. Test 530.3.5. Test 5

    run the command


    28.3.6. Test 630.3.6. Test 6

    Run the command


    28.3.7. Test 730.3.7. Test 7

    Run the command


    28.3.8. Test 830.3.8. Test 8

    On the PC type the command


    28.3.9. Test 930.3.9. Test 9

    Run the command


    28.3.10. Test 1030.3.10. Test 10

    Run the command


    28.3.11. Test 1130.3.11. Test 11

    From file manager try to browse the server. Your samba server should @@ -19519,8 +19690,8 @@ CLASS="SECT1" >


    28.4. Still having troubles?30.4. Still having troubles?

    Try the mailing list or newsgroup, or use the ethereal utility to -- cgit