View previous topic :: View next topic |
Author |
Message |
Belliash Advocate
Joined: 24 Nov 2004 Posts: 2503 Location: Wroclaw, Poland
|
Posted: Thu Mar 22, 2018 2:07 pm Post subject: Asking for root password when restarting services |
|
|
Hello guys,
I have recently migrated from GrSec to SELinux and actually, sometimes when I try to start/stop/restart/reload service it is asking me for root password ...
Of course I have root right already. I have this on 2 machines: This is the output from `id`:
id: | uid=0(root) gid=0(root) groups=0(root) context=staff_u:staff_r:staff_t |
id: | uid=0(root) gid=0(root) groups=0(root) context=staff_u:sysadm_r:sysadm_t |
As you can see context if different but problem exists on both of them.
Sometimes this is working nicely, but sometimes `rc-service [service] restart` or /etc/init.d/[service] lead to the following prompt:
: | # rc-service nginx reload
Authenticating root.
Password: |
How can I fix that? It is really annoying that I need to enter root password all the time....
Code: | # rc-service sshd restart
sshd | * Stopping sshd ... [ ok ]
sshd | * Starting sshd ... [ ok ]
# /etc/init.d/cronie restart
Authenticating root.
Password:
|
[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu] _________________ Asio Software Technologies
Belliash IT Weblog |
|
Back to top |
|
|
KintaroBC n00b
Joined: 15 Feb 2014 Posts: 63 Location: Australia
|
Posted: Wed Sep 23, 2020 1:25 pm Post subject: |
|
|
To fix this behaviour you edit /etc/pam.d/run_init with your favourite editor and remove a comment from a directive near the beginning of the file...
Code: |
# auth sufficient pam_rootok.so
|
The whole file should now look something like this...
Code: |
auth sufficient pam_rootok.so
auth include system-auth
account include system-auth
password include system-auth
session include system-auth
session optional pam_xauth.so
|
Now you should be able to restart nginx without trouble...
Code: |
# rc-service nginx restart
Authenticating root.
* Caching service dependencies ... [ ok ]
* Checking nginx' configuration ... [ ok ]
* Stopping nginx ... [ ok ]
* Starting nginx ... [ ok ]
|
|
|
Back to top |
|
|
|