lpadmin - Unix, Linux Command



NAME

lpadmin: Configure the lp print service.

SYNOPSIS

  • lpadmin [ -E ] [-U username ] [ -h server[:port] ] -d destination
  • lpadmin [ -E ] [-U username ] [ -h server[:port] ] -p destination [ -R name-default ] option(s)
  • lpadmin [ -E ] [-U username ] [ -h server[:port] ] -x destination
  • DESCRIPTION

    lpadmin configures printer and class queues provided by the common printing system CUPS. It can also be used to set the server default printer or class. When specified before the -d, -p, or -x options, the -E option forces encryption when connecting to the server. The first form of the command (-d) sets the default printer or class to destination. Subsequent print jobs submitted via the lp or lpr commands will use this destination unless the user specifies otherwise with the lpoptions command. The second form of the command (-p) configures the named printer or class. The additional options are described below. The third form of the command (-x) deletes the printer or class destination. Any jobs that are pending for the destination will be removed and any job that is currently printed will be aborted.

    Options

    Tag Description
    -c class Adds the named printer to class. If class does not exist it is created automatically.
    -i interface Sets a System V style interface script for the printer. This option cannot be specified with the -P option (PPD file) and is intended for providing support for legacy printer drivers.
    -m model Sets a standard System V interface script or PPD file for the printer from the model directory or using one of the driver interfaces. Use the -m option with the lpinfo command to get a list of supported models.
  • -o cupsIPPSupplies=true
  • -o cupsIPPSupplies=false
  • Specifies whether IPP supply level values should be reported.
    -o job-k-limit=value PriSets the kilobyte limit for per-user quotas. The value is an integer number of kilobytes; one kilobyte is 1024 bytes.nts files to the destination printer.
    -o job-page-limit=value Sets the page limit for per-user quotas. The value is the integer number of pages that can be printed; double-sided pages are counted as two pages.
    -o job-quota-period=value Sets the accounting period for per-user quotas. The value is an integer number of seconds; 86,400 seconds are in one day.
  • -o job-sheets-default=banner
  • -o job-sheets-default=banner,banner
  • Sets the default banner page(s) to use for print jobs.
    -o name=value Sets a PPD option for the printer. PPD options can be listed using the -l option with the lpoptions command.
    -o name-default=value Sets a default server-side option for the destination. Any print-time option can be defaulted.
    -o port-monitor=name Sets the binary communications program to use when printing, "none", "bcp", or "tbcp". The default program is "none". The specified port monitor must be listed in the printer's PPD file.
    -o printer-error-policy=name Sets the error policy to be used when the printer backend is unable to send the job to the printer. The name must be one of "abort-job", "retry-job", "retry-current-job", or "stop-printer". The default error policy is "stop-printer" for printers and "retry-current-job" for classes.
    -o printer-is-shared=[true|false] Sets the destination to shared/published or unshared/unpublished. Shared/published destinations are publicly announced by the server on the LAN based on the browsing configuration in cupsd.conf, while unshared/unpublished destinations are not announced. The default value is "true".
    -o printer-op-policy=name Sets the IPP operation policy associated with the destination. The name must be defined in the cupsd.conf in a Policy section. The default operation policy is "default".
    -R name-default Deletes the named option from printer.
    -r class Removes the named printer from class. If the resulting class becomes empty it is removed.
  • -u allow:user,user,@group
  • -u deny:user,user,@group
  • -u allow:all
  • -u deny:none
  • Sets user-level access control on a destination. Names starting with "@" are interpreted as UNIX groups. The latter two forms turn user-level access control off.
    -v "device-uri" Sets the device-uri attribute of the printer queue. Use the -v option with the lpinfo command to get a list of supported device URIs and schemes.
    -D "info" Provides a textual description of the destination.
    -E Enables the destination and accepts jobs; this is the same as running the cupsaccept and cupsenable programs on the destination.
    -L "location" Provides a textual location of the destination.
    -P ppd-file Specifies a PostScript Printer Description file to use with the printer. If specified, this option overrides the -i option (interface script).

    EXAMPLES

    Example-1:

    To add a new network printer with the name “HPLaserJetP3015” use the lpadmin command with -p option as shown below:

    # lpadmin -p HPLaserJetP3015 -v socket://19.86.82.172 -P 
    /usr/share/cups/model/HP/LaserJet_P3005-Postscript.ppd
    
    output:
    # lpstat -v device for HPLaserJetP3015: socket://19.86.82.172 To verify if the printer is configured currently, you can use the command as shown in the below example: # lpstat -p HPLaserJetP3015 -l printer HPLaserJetP3015 is idle. enabled since Sun Jan 11 16:11:41 2015

    Example-2:

    In order to configure the printer on the parallel port (/dev/lp0), use the lpadmin command as shown in this example:

    # lpadmin -p HPDESKJET882 -v parallel:/dev/lp0 -m 
    /usr/share/cups/model/HP/DeskJet_882C-cdj880.ppd 

    Example-3:

    Also to list all the available ports or interfaces available to configure the printer can be displayed using lpinfo command:

    # lpinfo -v
    network socket
    direct hp
    network http
    network ipp
    network lpd
    direct parallel:/dev/lp0
    direct scsi
    network tpvmgp
    network tpvmlp
    network smb 

    Example-4:

    To add a printer to the class, use the below command:

    # lpadmin -h localhost -p HPLaserJetP3015 -c myclass
    
    To verify whether the printers are in printer class:
    
     # lpstat -c myclass
     members of class myclass:
     HPLaserJetP3015 

    Example-5:

    To remove a printer from the class you can use the lpadmin command as shown in the below example:

     # lpstat -c myclass
     members of class myclass:
     HPLaserJetP3015
     HPDESKJET882
     Remove the HPDESKJET882 printer from myclass as shown below:
    
     # lpadmin -p HPDESKJET882 -r myclass
     Once you remove it, you’ll see only the HP Laser Jet Printer:
    
     # lpstat -c myclass
     members of class myclass:
     HPLaserJetP3015
     

    Example-6:

    Using the -x option, you can remove the class. as shown below.

     # lpstat -c myclass
     members of class myclass:
     HPLaserJetP3015
    
     # lpadmin -x myclass
    
     # lpstat -c myclass
     lpstat: Unknown destination "myclass"!
     
     Please note that the printer configuration still exists even if you removed the class.
    

    Example-7:

    To change the resolution of the printer to 300x300dpi, you can use the lpadmin command as shown below:.

    # lpadmin -p HPLaserJetP3015 -o Resolution=300x300dpi
    
     # lpoptions -p HPLaserJetP3015 -l 

    Example-8:

    To remove a CUPS printer from the printer configuration file, you can use the -x option as shown below:

     # lpstat -v
     device for HPLaserJetP3015: socket://19.86.82.172
    
     # lpadmin -x HPLaserJetP3015
    
     # lpstat -v
     lpstat: No destinations added.
    

    Example-9:

    Allow/Deny User or Groups to Configure Printer Options:

     # lpadmin -p HPLaserJetP3015 -u allow:karthik
     # lpadmin -p HPLaserJetP3015 -u deny:karthik
    
     The following will allow users from sysadmin group to configure printer options:
     
         # lpadmin -p HPLaserJetP3015 -u allow:@sysadmin
    
     The following will deny users from developer group to configure printer options:
     
         # lpadmin -p HPLaserJetP3015 -u deny:@developer
    
    Print
    Advertisements