Re: KDE not allowing shutdown/reboot

From: Thomas Otto (my21stnewsgroupdevnull_at_gmx.net)
Date: 01/11/04


Date: Sun, 11 Jan 2004 11:21:05 +0100


>>Normally, only root can shutdown, halt or reboot a system, but KDE's
>>default display manager is granting this priviledge to a non-root user.
>>The other managers or the terminal are not, which is the default.
>>Remember, Linux is really a multi-user, server OS, so users shouldn't
>>be able to shut it down.
>>
>>You can, as root, grant this priviledge to any user or user group. Just
>>grant user access to execute the shutdown command. 'man chmod' for
>>info.

Actually this doesn't work, but maybe you mean sudo or something
similar, see below.

> In my version, shutdown, reboot etc or controlled using PAM.
> According to /etc/pam.d/..., user access is granted to reboot and
> shutdown. I can verify this from the fact that I am able to reboot
> the system from my X console.
>
> So the permissions are already there. I donot know why KDE refuses to
> see them.

KDE contacts kdm (which is running with root privileges) to shutdown the
PC via the socket "/var/run/xdmctl/xdmctl-:0" whos ownership is changed
to the current user logged in. Basically KDE does
echo -e "shutdown\thalt\ttrynow" > /var/run/xdmctl/xdmctl-:0
and then quits X/kdm.

To be able to shutdown the system as a normal user use visudo to add the
following line to the /etc/sudoers file, then you will be able to
shutdown the PC with 'sudo /sbin/shutdown -h now':

yourlogin machinename= NOPASSWD: /sbin/shutdown -h now

   -Thomas