Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to poweroff reboot suspend and hibernate?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware
View previous topic :: View next topic  
Author Message
NUIL
n00b
n00b


Joined: 03 Sep 2018
Posts: 1

PostPosted: Mon Sep 03, 2018 6:19 am    Post subject: How to poweroff reboot suspend and hibernate? Reply with quote

How to poweroff reboot suspend and hibernate as ordinary user?
I'm using reboot poweroff pm-suspend and pm-hibernate as root, but what should I do to run this as ordinary user?
I have tried visuo and add something like this:
Code:
nil ALL =  /sbin/poweroff, /usr/sbin/pm-suspend

But it doesn't work at all.
Please tell me what should I do.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6229
Location: Room 101

PostPosted: Mon Sep 03, 2018 9:41 am    Post subject: Reply with quote

NUIL ...

when using sudo you retain the PATH for the user runing sudo, and by default /sbin (where poweroff is located) isn't in that PATH. I expect this is the issue (though providing the exact command, and output, is always recommended). That being the case either use 'sudo /sbin/poweroff' or add /sbin to path (and so execute 'sudo poweroff').

bash:
~/bash_profile:
export PATH="$PATH:/sbin"

zsh:
~/.zprofile:
if [[ $EUID != 0 ]] && (($+commands[sudo])) ; then
    typeset -xT SUDO_PATH sudo_path
    typeset -U sudo_path
    sudo_path=({,/usr/local,/usr}/sbin(N-/))
fi

~/.zshrc:
zstyle ':completion:*:sudo:*' environ PATH="$SUDO_PATH:$PATH"

HTH & best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Kernel & Hardware 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