Re: systemctl reboot

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Sat, 2014-09-13 at 17:42 +0200, Neven Sajko wrote:
> On 13 September 2014 17:30, Mateus Rodrigues Costa <charles.costar@xxxxxxxxx
> > wrote:
> > I think this is because your current session is the only session running.
> > In those situations systemctl power management commands don't ask for
> > root/sudo password. Not sure how to disable though.
> > If you had another session running (e.g. a VT) the commands would ask for
> > root/sudo password.

Correct, if I run a second session no reboot happens:


$ systemctl reboot
User chuser is logged in on tty2.
Please retry operation after closing inhibitors and logging out other users.
Alternatively, ignore inhibitors and users with 'systemctl reboot -i'.


_But_  systemctl reboot -i  does work with 2 sessions running by different users.


> Systemd, of course, *would* ask for a password, if polkit (PolicyKit)
> weren't there.

And yes, polkit is installed:
$ pacman -Q polkit
polkit 0.112-2


Since I also want to be ask for a password before screen locking or a
logout, I guess I'll use this or a similar scrip for fbpanel menu
entries:

$ cat /usr/local/bin/obexit
#!/bin/dash

# /usr/local/bin/obexit
obexit_version=2014.09.13

case $1 in
 .lock)         sudo -k echo
                if [ "$?" = "0" ]; then xflock4; fi;;
 .logout)       sudo -k echo
                if [ "$?" = "0" ]; then /usr/lib/fbpanel/xlogout; fi;;
 -o|--logout)   roxterm -T "Log Out"     -e obexit .logout;;
 -l|--lock)     roxterm -T "Lock Screen" -e obexit .lock;;
 -r|--restart)  roxterm -T "Restart"     -e sudo -k shutdown -r now;;
 -s|--shutdown) roxterm -T "Shut Down"   -e sudo -k shutdown -h now;;
 -a|--about)    echo "$0 $obexit_version Rocketmouse";;
 -v|--version)  echo "$obexit_version";;
 *)             echo Usage: obexit [OPTION]
                echo ".lock           xflock4 Lock Screen"
                echo ".logout         fbpanel Log Out"
                echo "-o, --logout    Term Log Out"
                echo "-l, --lock      Term Lock Screen"
                echo "-r, --restart   Term Restart"
                echo "-s, --shutdown  Term Shut Down"
                echo "-a, --about     About"
                echo "-v, --version   Version"
                ;;
esac


JFTR a user can run  shutdown -r now  too.

Regards,
Ralf


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux