Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

systemctl command

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
debiantu
Posts: 18
Joined: 2017-03-18 22:41

systemctl command

#1 Post by debiantu »

Hello all,

Am slowly reading through the Debian Handbook and have a question regarding to the systemctl command.

One of my goals in reading the handbook is to find ideas on to increase security of my Debian setup.

I've found that the Cups service is running and one measure of security is to turn off unneeded services.

So I typed the following to disable cups.service and listed also the results of the command:

Code: Select all

root@hostname:~#systemctl disable cups.service
Synchronizing state for cups.service with sysvinit using update-rc.d...
Executing /usr/sbin/update-rc.d cups defaults
Executing /usr/sbin/update-rc.d cups disable
insserv: warning: current start runlevel(s) (empty) of script `cups' overrides LSB defaults (2 3 4 5).
insserv: warning: current stop runlevel(s) (1 2 3 4 5) of script `cups' overrides LSB defaults (1).
Removed symlink /etc/systemd/system/sockets.target.wants/cups.socket.
Removed symlink /etc/systemd/system/paths.target.wants/cups.path.
To ensure that the service is actually defaults to disabled, I typed the following:

Code: Select all

root@hostname:~# systemctl is-enabled cups.service
disabled
I rebooted my computer to see if cups.service is still running and it appears to be disabled:

Code: Select all

root@hostname:~# systemctl is-enabled cups.service
disabled
The above command shows it disabled but when I type the following:

Code: Select all

root@hostname:~# ps aux | grep cups
root       569  0.0  0.6  86108  6544 ?        Ss   19:24   0:00 /usr/sbin/cupsd -f
root       586  0.0  0.4  71704  5088 ?        Ss   19:24   0:00 /usr/sbin/cups-browsed
root      1412  0.0  0.2  12732  2124 pts/0    S+   19:28   0:00 grep cups

Code: Select all

root@hostname:~# systemctl status cups.service
● cups.service - CUPS Printing Service
   Loaded: loaded (/lib/systemd/system/cups.service; disabled)
   Active: active (running) since Fri 2017-04-07 19:24:24 EDT; 4min 21s ago
     Docs: man:cupsd(8)
           man:cupsd.conf(5)
 Main PID: 569 (cupsd)
   CGroup: /system.slice/cups.service
           └─569 /usr/sbin/cupsd -f

Apr 07 19:24:24 hostname systemd[1]: Started CUPS Printing Service.
So what gives?? both the ps command and systemctl status command shows that the cups.service is still running.. I can still see the Cups page when I go to localhost:631..

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: systemctl command

#2 Post by pylkko »

If you disable a service this act in itself does not prevent another service or program from starting it, the service just does not autostart.

In order to see the dependencies you can look at

Code: Select all

systemctl list-dependencies
or for a specific service:

Code: Select all

systemctl list-dependecies cups.service
You can also mask a service, so that it will not be restarted or
you can also just uninstall cupsd and all that if you will never use it.

User avatar
debiman
Posts: 3063
Joined: 2013-03-12 07:18

Re: systemctl command

#3 Post by debiman »

pylkko wrote:you can also just uninstall cupsd and all that if you will never use it.
this is what i did.
i don't even own a printer.

User avatar
pylkko
Posts: 1802
Joined: 2014-11-06 19:02

Re: systemctl command

#4 Post by pylkko »

In theory it is, however, possible to imagine of situations where this might turn out to be "bad". For example, you don't own a printer and you purge it on laptop only to later notice that you need it in order to print someting on your work place's printer with that laptop or something else like this. But you have to know what your own needs are.

Post Reply