LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   How do users shutdown or reboot in slackware? (http://www.linuxquestions.org/questions/slackware-14/how-do-users-shutdown-or-reboot-in-slackware-699263/)

crusader7 01-22-2009 09:50 PM

How do users shutdown or reboot in slackware?
 
Hello

As a user, how do I shutdown or reboot slack?

I added a group
shutdown:x:102:root,crusader

As root I added halt, shutdown, and reboot to the shutdown group.

Quote:

12K -rwxr-xr-x 1 root shutdown 9.2K 2008-04-02 19:40 halt
0 lrwxrwxrwx 1 root shutdown 4 2008-12-30 13:03 reboot -> halt
20K -rwxr-xr-x 1 root shutdown 17K 2008-04-02 19:40 shutdown
In sudoers I added the following lines
%shutdown localhost=/sbin/shutdown -h now
%shutdown localhost=/sbin/reboot


Still for some reason I am not able to reboot or shutdown as a user.
Any suggestions

lstamm 01-22-2009 09:59 PM

The shutdown executable is in /sbin, which is not in a regular users path. Also you might need to prefix the command call with sudo, since you add the permission in the sudoers file. So try calling sudo /sbin/shutdown -r now; if that works then you can add an alias in your .bashrc files to call the commands with the full path and options you want, and all will be good. That's what I did - I shutdown and reboot with the aliased commands poweroff and reboot.

acummings 01-23-2009 02:03 AM

Anyone know if "merely add user to a certain group" will do it?

If is both a KDE user and run level 4 (GUI logon), you can easily use the control center in KDE to set up a user with both sys halt and reboot rights/permissions/ability for that user to then utilize/partake_of while from within KDE

Next is a run level 3 method/way for halt

al@G33T-M2:~$ alias
alias adf='df --human-readable'
alias ahalt='sudo /sbin/halt'


Code:

al@G33T-M2:~$ su
Password:

fortune: cpu time/usefulness ratio too high -- core dumped.

root@G33T-M2:/home/al# cat /etc/sudoers
# sudoers file.
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the sudoers man page for the details on how to write a sudoers file.
#

# Host alias specification

# User alias specification
User_Alias    TRUSTED = al

# Cmnd alias specification
Cmnd_Alias    SRVC = /usr/sbin/apachectl,/sbin/arp,/usr/bin/slrnpull,/sbin/halt
Cmnd_Alias    TOOLS = /sbin/mount,/sbin/umount,/home/al/bin/cdrecordeasy,/usr/local/bin/samba_do
Cmnd_Alias    FIREW = /usr/local/bin/firehol, /usr/local/bin/rc.vmware
Cmnd_Alias    PRNT = /usr/local/bin/cups.sh,/usr/bin/ethereal,/usr/local/bin/kqemu_do

# Defaults specification
Defaults:TRUSTED    !lecture
Defaults:al      !authenticate

# Runas alias specification

# User privilege specification
root    ALL=(ALL) ALL

# Uncomment to allow people in group wheel to run all commands
# %wheel        ALL=(ALL)      ALL

# Same thing without a password
# %wheel        ALL=(ALL)      NOPASSWD: ALL

# Samples
# %users  ALL=/sbin/mount /cdrom,/sbin/umount /cdrom
# %users  localhost=/sbin/shutdown -h now
TRUSTED  ALL = NOPASSWD:SRVC,TOOLS,FIREW,PRNT
root@G33T-M2:/home/al#


onebuck 01-23-2009 07:54 AM

Hi,

Most of my systems are up 24/7 so I really don't shutdown that often. When I do then I use either 'shutdown -r now' or 'shutdown -h now'. But as I stated there generally is no need to shutdown.

tronayne 01-23-2009 10:20 AM

As an option, you can simply use the init utility (instead of shutdown); e.g.,
Code:

init 0
shuts down the operating system and turns off the power.
Code:

init 6
reboots the system.
Code:

init 1
shuts down to single-user mode; I use this to install software patches, for example bind, openssl and the like followed by
Code:

init 6
to reboot to multi-user.

Maybe a little simpler...

apolinsky 01-23-2009 12:58 PM

You can always use the old 'thre fingered' salute. The action of control, alt, delete is handled by /etc/inittab. By default it is set to a reboot, but if you change the ctrlaltdelete entry, it can halt.

sxtytwofrd 01-23-2009 01:13 PM

If you add the user account to the "power" group they should be able to shutdown the machine. I used this for Xfce.

Rob

crusader7 01-24-2009 09:25 PM

Thanks a bunch

I added to .bashrc as Istamm suggested.

alias off='sudo /sbin/shutdown -h now'
alias reboot='sudo /sbin/reboot'

I also did as stated in the first post.

That seemed to work for me.

crusader7 01-24-2009 09:38 PM

Quote:

Originally Posted by sxtytwofrd (Post 3418902)
If you add the user account to the "power" group they should be able to shutdown the machine. I used this for Xfce.

Rob

halt, poweroff, reboot, etc ... in /sbin were all in root:root owner/group respectively, so I am not sure how adding myself to the power group would work. It makes alot of sense though.

crusader7 01-24-2009 09:46 PM

Quote:

Originally Posted by onebuck (Post 3418553)
Hi,

Most of my systems are up 24/7 so I really don't shutdown that often. When I do then I use either 'shutdown -r now' or 'shutdown -h now'. But as I stated there generally is no need to shutdown.

I have a dell 5150 notebook which is notorious for heating issues. I installed dellfand and set the temp for the fan to run on high at 49C. At times the fan throttles even when in standby mode. Also the screen back light never shuts off. Therefore, I usually turn my computer off at the end of the day. I never figured out what to do with those issues.

dugan 01-24-2009 10:45 PM

Personally, I just do "su -c 'poweroff'".

Adding a user account to the power group allows that user to shut down via HAL, which works in Xfce (and probably KDE).

Are you setting up an account for someone who needs to shut down, but shouldn't have the root password and doesn't use Xfce or KDE?

Catacombs 01-27-2009 06:23 PM

I generally use "halt", simply because it's quicker than "shutdown". Just a thought, if you want everybody to be able to shutdown and reboot, then why not just change the permissions of the two commands so that everybody can, instead of using more long-winded methods? I guess that's the beauty of Linux. So many different ways to do the same thing.

$lackn00b 01-27-2009 10:02 PM

I'm new to linux but...
 
on my slacktop i usually ctrl+ALT+delete to reboot or just press my power off button to shutdown. but this in when i'm out of the gui. in slack 12.2 it never says i have done something wrong. even when i boot up there is no error so that's my 2 cents. hope it helps. god bless.

Catacombs 01-31-2009 10:08 PM

Quote:

Originally Posted by $lackn00b (Post 3423572)
on my slacktop i usually ctrl+ALT+delete to reboot or just press my power off button to shutdown. but this in when i'm out of the gui. in slack 12.2 it never says i have done something wrong. even when i boot up there is no error so that's my 2 cents. hope it helps. god bless.

CTRL+ALT+DELETE is a perfectly clean way to shutdown. It does exactly the same as more formal methods, but then you do have to press the "off" switch to prevent it from rebooting.

Pressing the "off" button could be perfectly ok or incredibly stupid depending how your computer is configured. With some configurations, it will simply tell the OS to do a clean shutdown. With others, it could be a brutal and potentially file-corrupting "hard reset". I'm still using the non-journalling ext2 file system, so I haven't the courage to try the "off" button for fear of loads of file-system errors and lots of fscking around. (Pun intended)

Be aware that if you're using a journalling file system, for example, ext3, reiserfs, XFS, you wouldn't get many error message even with an unsafe shutdown, and they would pass up the screen without you noticing, yet still not be exactly ideal. Journalled file-systems should be used as a failsafe for when you really can't shutdown cleanly, not just an excuse for laziness.


All times are GMT -5. The time now is 06:25 PM.