Solved Shutdown/Reboot as a user

faysal76

New Member

Reaction score: 2
Messages: 9

Hi folks,
I am using FreeBSD 10 with xfce4 desktop environment on HP/Compaq 6910p notebook. I am facing problem in shutting down and reboot as a user. I also couldn't find battery status while charging or discharging status. While all of above do quite well as a root user. I also tried to edit PolicyKit.conf but in vain.

Thanks in Advance for any guidance. Regards.
 
Last edited by a moderator:

trh411

Aspiring Daemon

Reaction score: 52
Messages: 865

Re: Shutdown/Reboot as a user

You need to add the user to the operator group.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 8,083
Messages: 31,689

Re: Shutdown/Reboot as a user

Did you follow these instructions?

Code:
dice@molly:~ % pkg info -D xfce4-session
xfce4-session-4.10.1_2:
To be able to shutdown or reboot your system, you'll have to add a .pkla file
in /usr/local/etc/polkit-1/localauthority/50-local.d directory. Which looks
like this (replace PUTYOURGROUPHERE by your group):

[Restart]
Identity=unix-group:PUTYOURGROUPHERE
Action=org.freedesktop.consolekit.system.restart
ResultAny=yes
ResultInactive=yes
ResultActive=yes

[Shutdown]
Identity=unix-group:PUTYOURGROUPHERE
Action=org.freedesktop.consolekit.system.stop
ResultAny=yes
ResultInactive=yes
ResultActive=yes

For those who have working suspend/resume:

[Suspend]
Identity=unix-group:PUTYOURGROUPHERE
Action=org.freedesktop.upower.suspend
ResultAny=yes
ResultInactive=yes
ResultActive=yes
After making changes to this file you have to restart DBUS and log out and in again for the changes to activate. Or simply reboot.

Battery status I think is done by sysutils/xfce4-power-manager. I'm not sure but it's possible it's not installed automatically with x11-wm/xfce4. You should be able to add it without problems.
 

wblock@

Beastie Himself
Developer

Reaction score: 3,649
Messages: 13,850

Re: Shutdown/Reboot as a user

In addition to the entries in /usr/local/etc/polkit-1/localauthority/50-local.d/org.freedesktop.consolekit.pkla, xfce must be started with ConsoleKit support:
startxfce4 --with-ck-launch
 
OP
OP
faysal76

faysal76

New Member

Reaction score: 2
Messages: 9

Re: Shutdown/Reboot as a user

Thanks to all folks. I am feeling much happy with forum. All of you are much helping. Thanks again.
 

cac

New Member

Reaction score: 3
Messages: 6

I hate to bring this up again since it is marked solved (although in the original posters final post we aren't told if the problem was solved, only that the poster is happy with the forum), but the solution is not working for me.

Briefly, I've done everything in the thread, including the final startxfce4 --with-ck-launch and only the logout button is enabled (not grey) -- as it was before this long descent into polkit-land ;-). I assume all of this is for security reasons and am not complaining, but it is ironic that the window manager we choose for its simplicity turns out to have an unbelievably complex procedure for allowing itself and the OS to be shut down (and one which for me still doesn't work, although I can live with the two-step process of logging out of Xfce (which also shuts X11 down) and then shutting the system down from the console).
 

teo

Aspiring Daemon

Reaction score: 22
Messages: 535

SirDice said:
After making changes to this file you have to restart DBUS and log out and in again for the changes to activate. Or simply reboot.
Hello SirDice!

How should I proceed to add or create file .pkla in /usr/local/etc/polkit-1/localauthority/50-local.d directory? And replace PUTYOURGROUPHERE by your group?

Example:

Code:
[Restart]
Identity=unix-group:  UTYOURGROUPHERE
Action=org.freedesktop.consolekit.system.restart
ResultAny=yes
ResultInactive=yes
ResultActive=yes
 

Halberdier

New Member


Messages: 16

I hate to bring this up again since it is marked solved (although in the original posters final post we aren't told if the problem was solved, only that the poster is happy with the forum), but the solution is not working for me.

Briefly, I've done everything in the thread, including the final startxfce4 --with-ck-launch and only the logout button is enabled (not grey) -- as it was before this long descent into polkit-land ;-). I assume all of this is for security reasons and am not complaining, but it is ironic that the window manager we choose for its simplicity turns out to have an unbelievably complex procedure for allowing itself and the OS to be shut down (and one which for me still doesn't work, although I can live with the two-step process of logging out of Xfce (which also shuts X11 down) and then shutting the system down from the console).
Identical situation and identical feelings :)
 

tedbell

Active Member

Reaction score: 87
Messages: 200

LOL🤣

Add
Code:
%wheel ALL=(ALL) NOPASSWD: /sbin/shutdown -r now 
%wheel ALL=(ALL) NOPASSWD: /sbin/shutdown -p now
to your sudoers file.
Bada bing, bada boom.
 

golpemortal

Member

Reaction score: 3
Messages: 60

tedbell

Bada bing, bada boom I do not use sudo.

what I did to fixed this on my Lenovo ThinkPad T550 was this

Edit # nano /usr/local/etc/polkit-1/rules.d/50-default.rules
and added the following to the file save and rebooted and it worked. Now I can reboot and shutdown on xfce4 as a regular user " Bada bing, bada boom. " :cool:


Code:
polkit.addRule(function (action, subject) {
  if ((action.id == "org.freedesktop.consolekit.system.restart" ||
      action.id == "org.freedesktop.consolekit.system.stop")
      && subject.isInGroup("operator")) {
    return polkit.Result.YES;
  }
});


polkit.addRule(function (action, subject) {
  if (action.id == "org.freedesktop.consolekit.system.suspend"
      && subject.isInGroup("operator")) {
    return polkit.Result.YES;
  }
});

});
 
Top