Home / Alt manpages / cupsctl(8)

  • cupsctl(8)
  • Admin command
  • linux

Change CUPS Server Settings Safely with cupsctl

You will inspect a CUPS scheduler, change one supported server setting, verify the result, and put it back if the change was only a test. The examples use cupsctl from the Debian/Ubuntu cups-client package, version 2.4.7-1.2ubuntu7.14 on this machine. Allow about ten minutes, plus a maintenance window if the scheduler serves other people.

You need a shell, a running CUPS scheduler, and permission to administer it. Reading settings is normally an ordinary user operation. Changing them may require authentication or elevated privileges, depending on the server's policy. This command edits the scheduler's configuration through CUPS; it does not replace careful review of cupsd.conf.

1. Check the installed command and scheduler

Confirm the binary and package version before relying on an example. This is read-only:

$ command -v cupsctl
/usr/bin/cupsctl
$ dpkg-query -W -f='${Package} ${Version}\n' cups-client
cups-client 2.4.7-1.2ubuntu7.14

Now ask the local scheduler for its current settings:

$ cupsctl
name=value
name=value

The real output contains one setting per line. If you see Unable to connect to server, stop here. Start by checking the CUPS service and its logs with your normal service-management procedure. Do not start changing client options to hide a server outage.

Checkpoint: you have confirmed the binary, package version, and a working connection to the intended scheduler.

2. Record the setting you are about to change

Use a narrow query when you need one value. The setting names printed by cupsctl use an underscore prefix, so match the complete name rather than searching for a loose word:

$ cupsctl | grep '^_share_printers='

For debug logging, the corresponding check is:

$ cupsctl | grep '^_debug_logging='

Save the returned name=value line in your change notes. If the command prints nothing, do not assume the value is safely off. Query the full output, check the scheduler you selected, and review its access policy first.

3. Make one focused change

The boolean switches supported by this version are explicit. Use the --no- form to disable a feature and change one setting at a time.

To stop this server advertising its local printers to other computers:

$ cupsctl --no-share-printers

To enable it again later:

$ cupsctl --share-printers

A successful command may produce no standard output. Verify instead:

$ cupsctl | grep '^_share_printers='

Do not use sudo automatically. If the server rejects the change because authentication is required, run the same operation with the privilege your local policy expects, or authenticate as a named administrator. A typical local retry is:

$ sudo cupsctl --no-share-printers

That command changes server state. Review the target host and the option immediately before pressing Enter, particularly when the shell is connected to a production print server.

4. Handle logging as a temporary diagnostic

Debug logging can help investigate a scheduler problem, but it writes more detail to the CUPS error_log. Enable it only for the shortest useful interval:

$ cupsctl --debug-logging
$ cupsctl | grep '^_debug_logging='
_debug_logging=1

Reproduce the problem, collect the relevant log entries through your normal incident process, then turn the setting off:

$ cupsctl --no-debug-logging
$ cupsctl | grep '^_debug_logging='
_debug_logging=0

Exact output can differ if another administrator changes the scheduler between commands. Avoid leaving debug logging enabled: it increases log volume and may capture more operational detail than a routine service needs.

5. Treat remote access options as a security boundary

--remote-admin permits remote administration, while --remote-any allows printing from any address, including potentially the Internet. These are not harmless connectivity tests. Enabling either can widen who can reach or use the scheduler, and the exact result still depends on firewall rules, authentication, TLS and the rest of cupsd.conf.

If a documented maintenance task genuinely requires remote administration, capture the original values first, make the smallest change, test from the approved network, and disable it when finished:

$ cupsctl | grep -E '^_(remote_admin|remote_any)='
$ cupsctl --remote-admin
$ cupsctl | grep '^_remote_admin='
$ cupsctl --no-remote-admin

Do not enable --remote-any as a way to solve an unknown printer-discovery problem. Investigate routing, firewall policy, name resolution and the intended CUPS sharing model instead. If you must undo that setting after an emergency test, use:

$ cupsctl --no-remote-any

6. Use an alternate server carefully

The -h option selects a server and optional port. It must appear before all other options:

$ cupsctl -h print-server.example:631
$ cupsctl -h print-server.example:631 --no-share-printers

Replace print-server.example:631 with a hostname and port you have confirmed. The first command is a query; the second changes the remote scheduler. If the connection needs encryption, add -E after the server option:

$ cupsctl -h print-server.example:631 -E

-U USERNAME selects an alternate username for authentication. It does not grant that account permission. Do not put passwords in the command line, shell history or an article example.

7. Know what cupsctl cannot change

The command supports the documented logging, remote access, printer-sharing and job-cancellation switches, along with supported name=value parameters. It cannot set the Listen or Port directives. Do not keep trying variants of cupsctl Listen=... when the task is to change where the scheduler listens. Review cupsd.conf(5), use the configuration process approved for that host, and plan the service reload or restart separately.

The --user-cancel-any option also changes an authorisation boundary: it allows users to cancel jobs owned by others. Enable it only when that policy is deliberate, and undo it with --no-user-cancel-any if it was temporary.

Done means

  • cupsctl and its installed package version were checked.
  • The intended scheduler was queried before any change.
  • The original setting was recorded and only one focused option was changed.
  • The result was verified by querying the relevant name=value line.
  • Temporary debug or remote-access changes were disabled again.
  • You did not use cupsctl for unsupported Listen or Port directives.