LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 01-22-2009, 09:50 PM   #1
crusader7
Member
 
Registered: Dec 2008
Distribution: Ubuntu and Debian
Posts: 36

Rep: Reputation: 16
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
 
Old 01-22-2009, 09:59 PM   #2
lstamm
Member
 
Registered: Aug 2007
Location: McBride, BC, Canada
Distribution: Slackware, OpenBSD, Edubuntu
Posts: 53

Rep: Reputation: 18
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.
 
Old 01-23-2009, 02:03 AM   #3
acummings
Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 615

Rep: Reputation: 50
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#
 
Old 01-23-2009, 07:54 AM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Central Florida 20 minutes from Disney World
Distribution: SlackwareŽ
Posts: 13,923
Blog Entries: 44

Rep: Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158Reputation: 3158
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.
 
Old 01-23-2009, 10:20 AM   #5
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
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...
 
Old 01-23-2009, 12:58 PM   #6
apolinsky
Member
 
Registered: Oct 2004
Location: Brooklyn
Distribution: Slackware 15;
Posts: 440

Rep: Reputation: 46
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.
 
Old 01-23-2009, 01:13 PM   #7
sxtytwofrd
LQ Newbie
 
Registered: Oct 2005
Distribution: Slackware
Posts: 3

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

Rob
 
Old 01-24-2009, 09:25 PM   #8
crusader7
Member
 
Registered: Dec 2008
Distribution: Ubuntu and Debian
Posts: 36

Original Poster
Rep: Reputation: 16
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.

Last edited by crusader7; 01-24-2009 at 09:33 PM.
 
Old 01-24-2009, 09:38 PM   #9
crusader7
Member
 
Registered: Dec 2008
Distribution: Ubuntu and Debian
Posts: 36

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by sxtytwofrd View Post
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.
 
Old 01-24-2009, 09:46 PM   #10
crusader7
Member
 
Registered: Dec 2008
Distribution: Ubuntu and Debian
Posts: 36

Original Poster
Rep: Reputation: 16
Quote:
Originally Posted by onebuck View Post
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.
 
Old 01-24-2009, 10:45 PM   #11
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,219

Rep: Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309Reputation: 5309
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?

Last edited by dugan; 01-24-2009 at 11:00 PM.
 
Old 01-27-2009, 06:23 PM   #12
Catacombs
LQ Newbie
 
Registered: Jan 2009
Distribution: Slackware
Posts: 24

Rep: Reputation: 16
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.
 
Old 01-27-2009, 10:02 PM   #13
$lackn00b
LQ Newbie
 
Registered: Jan 2009
Posts: 4

Rep: Reputation: 0
Smile 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.
 
Old 01-31-2009, 10:08 PM   #14
Catacombs
LQ Newbie
 
Registered: Jan 2009
Distribution: Slackware
Posts: 24

Rep: Reputation: 16
Quote:
Originally Posted by $lackn00b View Post
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How I got XFCE to allow users to shutdown or reboot Slackware 10.2 Old_Fogie Slackware 11 03-22-2006 03:04 PM
/lib/libthread_db.so.1 crashes at shutdown or reboot on Slackware 10.1 with Qt 3.3.4 Basel Slackware 13 07-15-2005 03:03 AM
NEWBIE Slackware 10.0 --> logout shutdown reboot (CTRL-ALT-F2) confused?? koodoo Linux - Newbie 5 06-01-2005 06:21 PM
NEWBIE Slackware 10.0 --> logout shutdown reboot (CTRL-ALT-F2 confused?? koodoo Linux - Newbie 1 05-31-2005 05:51 PM
Immediate shutdown/reboot Creep Linux - Hardware 4 03-07-2004 04:56 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 10:24 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration