Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Asking for root password when restarting services
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Belliash
Advocate
Advocate


Joined: 24 Nov 2004
Posts: 2503
Location: Wroclaw, Poland

PostPosted: Thu Mar 22, 2018 2:07 pm    Post subject: Asking for root password when restarting services Reply with quote

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
View user's profile Send private message
KintaroBC
n00b
n00b


Joined: 15 Feb 2014
Posts: 63
Location: Australia

PostPosted: Wed Sep 23, 2020 1:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum