Eduloc
Eduloc

Reputation: 53

CentOS systemctl access denied

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

Upvotes: 4

Views: 19500

Answers (6)

jokereven
jokereven

Reputation: 19

i have meet it in arch linux, when i use common user to run systemctl enable, it's like Access denied, when i use a root user to run it's, i resolve it, place.

Upvotes: 0

Aashutosh Kumar
Aashutosh Kumar

Reputation: 831

During the upgrade of Debian or Ubuntu server you may encounter strange failing of scripts which are restarting services.

For some reason it’s not possible to call systemcl and any operation fails with Access denied even for root.

Here is example:

systemctl list-units
Failed to list units: Access denied

The fix to this problem it is sufficient to send TERM signal to process with PID #1:

kill -TERM 1

Credits: https://georgik.rocks/systemctl-failed-to-list-units-access-denied/

Upvotes: 1

MeowRude
MeowRude

Reputation: 176

Please execute the following commands in order:

sudo systemctl daemon-reexec
sudo systemctl daemon-reload

Worked for me.

Upvotes: 2

rjdkolb
rjdkolb

Reputation: 11858

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

Upvotes: 3

Litty Philip
Litty Philip

Reputation: 1145

Use systemctl daemon-reexec

It's safer than setenforce 0

Upvotes: -1

Hossein.Kiani
Hossein.Kiani

Reputation: 137

Run below command and try again. We will be found a new way if this not worked

su -

Upvotes: -1

Related Questions