CentOS systemctl access denied

Eduloc picture Eduloc · Nov 8, 2016 · Viewed 12k times · Source

I would disable Ctrl-Alt-Delete in my CentOS server so I tried:

systemctl mask ctrl-alt-delete.target

but I got:

Failed to execute operation: Access Denied

What can I do ?
PS: I'm root on the server

Answer

rjdkolb picture rjdkolb · Mar 16, 2017

This can happen when you try to enable a service that does not exist, but is not specific to 'systemctl mask ctrl-alt-delete.target':

> systemctl enable blabla
Failed to execute operation: Access denied

Looks like this is a Centos / Fedora etc. issue.

If you run 'setenforce 0' you will get a better error:

> setenforce 0
> systemctl enable blabla
Failed to execute operation: No such file or directory

Don't forget to re-enable:

> setenforce 1
> getenforce
Enforcing

In Ubuntu you will get the above error without running setenforce 0