LinuxCommandLibrary

cupsaddsmb

Share CUPS printers with Windows clients

SYNOPSIS

cupsaddsmb [-h] [-H smbconf] [-P] [-u user] [-v] [printer [printer ...]]

PARAMETERS

-h
    Show command usage and exit.

-H smbconf
    Alternative Samba config file (default: /etc/samba/smb.conf)

-P
    Omit [print$] driver share from config.

-u user
    Set config file owner to user (default: root).

-v
    Verbose: print generated config to stdout.

DESCRIPTION

cupsaddsmb generates Samba printer share configurations from CUPS printers. It reads /etc/cups/printers.conf (or equivalent) and appends [printername] sections plus optional [printers] and [print$] shares to smb.conf, enabling SMB/CIFS printer access for Windows clients.

Designed for seamless CUPS-Samba integration, it handles printer-specific paths, drivers, and permissions. Run as root after adding printers via lpadmin(8). Verbose mode outputs config to stdout for review.

Supports multiple printers per invocation. Post-execution, validate with testparm(1) and reload Samba via systemctl reload smb or smbcontrol. Ideal for print servers sharing queues network-wide.

CAVEATS

Requires root privileges. Back up smb.conf first—appends to end, may duplicate shares. Samba/CUPS must be installed. No removal function; edit manually.

EXAMPLE

cupsaddsmb -v -H /etc/samba/smb.conf MyPrinter
Generates and prints config snippet; review before applying.

POST-RUN

Always run testparm after; restart Samba: systemctl reload smb.

HISTORY

Introduced in CUPS 1.1 (2001) for Samba 2.x integration; evolved with CUPS 2.x for PPD/driver handling.

SEE ALSO

lpadmin(8), lpstat(1), testparm(1), smbd(8), cupsctl(8)

Copied to clipboard