I was recently tasked with the installation, configuration and setup of a Ubuntu 8.04 CUPS based Linux print server for one of our clients. Being a Linux enthusiast, this is a relatively simple task; however, I was used to the GUI configuration side of things. The documentation for CUPS and Samba is... okay... but they don't do a good job at explaining the why, or the results of a particular configuration value.
Through the discovery, research and testing, I created a short howto document to recreate essentially what I did. The following is the "blog" like conversion of the document. Please feel free to comment, criticize and suggest changes! I hope this post will help shed some light about Samba and CUPS!
~Jaymes Bearden, ATWS
The following are steps to setup and configure a CUPS based Linux print server. Some steps may require modification to fit your exact environment. This process should take an advanced user approximately 15 minutes to complete. For new users that carefully follow these steps, this guide should take approximately 45 minutes to an hour to complete.
Example: sudo apt-get install cupsys
Using a computer that is connected to the same network as the CUPS server, or on a network that you defined to be allowable in the cupsd.conf file, use a browser to connect to the CUPS configuration webpage. You will need to supply the IP address of the server followed by a colon (:) and the port as defined in the cupsd.conf. The default port is 631.
After navigating to this page, you will be presented with the CUPS control panel. Here you can add, remove and modify printers, setup printer groups called classes (3rdFloor, 2nd Floor, East Wing, etc), print test pages, change printer options, move print jobs between printers and much more.
You may to need find and download Linux/CUPS specific drivers for your server. Sometimes the printer will be auto-detected and may not need the following steps. If your printer was auto-detected, make sure it is functioning correctly by printing a test page; otherwise, you may have to follow the vendor specific instructions for your printer to install the appropriate Linux print drivers.
View Appendix C for an example setup of a Samsung ML2010 printer.
To setup a new printer, follow these steps after connecting to the CUPS control panel with a browser:
At this point you should have a working CUPS printer that is browsable through the network.
In order to execute these steps, you must connect to the server using the username that was set with the "printer admin = ..." option in the smb.conf file. This user must also be added to Samba's user database using sudo smbpasswd -a. Before beginning these steps, restart samba and cups on the server with the following commands: sudo /etc/init.d/samba restart; sudo/etc/init.d/cups restart
At this point, you can right click the printer and click connect. This will "install" the printer on to the current machine and you will be able to print to the printer.
The configuration files that are provided with this guide are considered to relatively restrictive. If you wish to relax the security restrictions, follow these steps:
Set the following options in /etc/samba/smb.conf:
This setup allows all computers to connect and browse the Samba server. If the user account from Windows that is connecting to the server exists on the server and has been added to Samba's user database (using smbpasswd -a) and has been supplied the correct password (ie: the Window's account name and password exactly matches the username and password in the Samba database) then the user is considered to be an authenticated user.
If the Windows account name and password does not exist, or the wrong password was supplied, the user the is attempting to connect to the Samba server becomes a "guest" using the Linux account "nobody" obtaining the filesystem permissions of "nobody".
With this setup, all users should be able to browse to the server, view its shares, connect to the printer and print documents.
Cupsd.conf requires special considerations for its security configuration. In the <Location> tags, careful attention must be given to the "Allow From" directives and they should be setup to apply only to the network configuration that is available.
Generally, it is best practice to only allow access to the CUPS Control panel from the localhost of the server so only users directly connected to the server can modify printer configurations.
The attached cupsd.conf is configured to be very permissive.
#======================= Global Settings =======================
[global]
## Browsing/Identification ###
# Change this to the workgroup/NT-domain name your Samba server will part of
workgroup = YOURWORKGROUP
# server string is the equivalent of the NT Description field
# The following displays whatever you set your HOST name as
server string = %h
# Windows Internet Name Serving Support Section:
# WINS Support - Tells the NMBD component of Samba to enable its WINS Server
; wins support = no
# WINS Server - Tells the NMBD components of Samba to be a WINS Client
# Note: Samba can be either a WINS Server, or a WINS Client, but NOT both
; wins server = w.x.y.z
# This will prevent nmbd to search for NetBIOS names through DNS.
dns proxy = no
# What naming service and in what order should we use to resolve host names
# to IP addresses
; name resolve order = lmhosts host wins bcast
#### Networking ####
# The specific set of interfaces / networks to bind to
# This can be either the interface name or an IP address/netmask;
# interface names are normally preferred
; interfaces = 127.0.0.0/8 eth0
# Only bind to the named interfaces and/or networks; you must use the
# 'interfaces' option above to use this.
# It is recommended that you enable this feature if your Samba machine is
# not protected by a firewall or is a firewall itself. However, this
# option cannot handle dynamic or non-broadcast interfaces correctly.
; bind interfaces only = true
#### Debugging/Accounting ####
# This tells Samba to use a separate log file for each machine
# that connects
log file = /var/log/samba/log.%m
# Cap the size of the individual log files (in KiB).
max log size = 1000
# If you want Samba to only log through syslog then set the following
# parameter to 'yes'.
; syslog only = no
# We want Samba to log a minimum amount of information to syslog. Everything
# should go to /var/log/samba/log.{smbd,nmbd} instead. If you want to log
# through syslog you should set the following parameter to something higher.
syslog = 0
# Do something sensible when Samba crashes: mail the admin a backtrace
panic action = /usr/share/samba/panic-action %d
####### Authentication #######
# "security = user" is always a good idea. This will require a Unix account
# in this server for every user accessing the server. See
# /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/ServerType.html
# in the samba-doc package for details.
security = user
# You may wish to use password encryption. See the section on
# 'encrypt passwords' in the smb.conf(5) manpage before enabling.
encrypt passwords = true
# If you are using encrypted passwords, Samba will need to know what
# password database type you are using.
# tdbsam is the default. You can modify it with pdbedit or smbpasswd
passdb backend = tdbsam
obey pam restrictions = yes
# guest account = nobody
# The following is good for network security. If this server can indirectly be accessed from the internet, you should probably include the following line.
invalid users = root
# This boolean parameter controls whether Samba attempts to sync the Unix
# password with the SMB password when the encrypted SMB password in the
# passdb is changed.
unix password sync = no
# For Unix password sync to work on a Debian GNU/Linux system, the following
# parameters must be set (thanks to Ian Kahan < for
# sending the correct chat script for the passwd program in Debian Sarge).
passwd program = /usr/bin/passwd %u
passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
# This boolean controls whether PAM will be used for password changes
# when requested by an SMB client instead of the program listed in
# 'passwd program'. The default is 'no'.
pam password change = no
# If the supplied password is incorrect for the username (for Windows machines, they send the current
# username and password of the logged in user), then reject and DONT allow that user to connect or browse.
# This will essentially not drop the user to Guest permissions
map to guest = never
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you'll need this
load printers = yes
printing = cups
printcap name = cups
printer admin = USERADMIN
############ Misc ############
# Most people will find that this option gives better performance.
# See smb.conf(5) and /usr/share/doc/samba-doc/htmldocs/Samba3-HOWTO/speed.html
# for details
# You may want to add the following on a Linux system:
# SO_RCVBUF=8192 SO_SNDBUF=8192
socket options = TCP_NODELAY
# Setup usershare options to enable non-root users to share folders
# with the net usershare command.
# Maximum number of usershare. 0 (default) means that usershare is disabled.
; usershare max shares = 100
# Allow users who've been granted usershare privileges to create
# public shares, not just authenticated ones
usershare allow guests = yes
#======================= Share Definitions =======================
[printers]
comment = All Printers
browseable = yes
path = /var/spool/samba
printable = yes
guest ok = yes
read only = yes
# Windows clients look for this share name as a source of downloadable
# printer drivers
[print$]
comment = Printer Drivers
path = /var/lib/samba/printers
browseable = yes
read only = yes
guest ok = yes
write list = root, @lpadmin, YOURUSER
#
# Sample configuration file for the Common UNIX Printing System (CUPS)
# scheduler. See "man cupsd.conf" for a complete description of this
# file.
#
# Log general information in error_log - change "info" to "debug" for
# troubleshooting...
LogLevel warning
# Administrator user group...
SystemGroup lpadmin
# Use the following line to only allow connections from the local machine
#Listen localhost:631
Listen /var/run/cups/cups.sock
# The following line allows connections from anywhere to port 631
Port 631
# Show shared printers on the local network.
Browsing On
BrowseOrder allow,deny
BrowseAllow all
# The following allows browse access from the 192.168.1.* network. This will need to be adjusted for your network.
BrowseAddress 192.168.1.255
# Default authentication type, when authentication is required...
DefaultAuthType Basic
# Restrict access to the server...
<Location />
Order allow,deny
Allow From 192.168.1.*
Allow From 192.168.0.*
Allow From 127.0.0.1
Allow From localhost
</Location>
# Restrict access to the admin pages...
<Location /admin>
Order allow,deny
Allow From 192.168.1.104
</Location>
# Restrict access to configuration files...
<Location /admin/conf>
AuthType Default
# Require group lpadmin
# Require user ubuntu
Order allow,deny
</Location>
# Set the default printer/job policies...
<Policy default>
# Job-related operations must be done by the owner or an administrator...
<Limit Send-Document Send-URI Hold-Job Release-Job Restart-Job Purge-Jobs Set-Job-Attributes Create-Job-Subscription Renew-Subscription Cancel-Subscription Get-Notifications Reprocess-Job Cancel-Current-Job Suspend-Current-Job Resume-Job CUPS-Move-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
# All administration operations require an administrator to authenticate...
<Limit CUPS-Add-Modify-Printer CUPS-Delete-Printer CUPS-Add-Modify-Class CUPS-Delete-Class CUPS-Set-Default>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# All printer operations require a printer operator to authenticate...
<Limit Pause-Printer Resume-Printer Enable-Printer Disable-Printer Pause-Printer-After-Current-Job Hold-New-Jobs Release-Held-New-Jobs Deactivate-Printer Activate-Printer Restart-Printer Shutdown-Printer Startup-Printer Promote-Job Schedule-Job-After CUPS-Accept-Jobs CUPS-Reject-Jobs>
AuthType Default
Require user @SYSTEM
Order deny,allow
</Limit>
# Only the owner or an administrator can cancel or authenticate a job...
<Limit Cancel-Job CUPS-Authenticate-Job>
Require user @OWNER @SYSTEM
Order deny,allow
</Limit>
<Limit All>
Order deny,allow
</Limit>
</Policy>
To install the Linux driver for the Samsung ML2010 printer on Ubuntu 8.04, follow these steps:
The specific driver should now show up. For more information view the thread from step 1 and also the instructions located at http://www-personal.umich.edu/~tjwatt/suldr/