LinuxQuestions.org
Review your favorite Linux distribution.
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 03-25-2005, 04:32 AM   #1
spariggio82
Member
 
Registered: Apr 2004
Location: Camporotondo Etneo, Sicily
Distribution: SuSE 8.2 SuSE 9.1 Fedora C1 Slackware 10.1 Knoppix 3.9
Posts: 174

Rep: Reputation: 30
halt and reboot system from user


Hi to all

I've just installed Slackware 10.1 on my PC and it works fine!!!!

However I wanna know how to reboot or shut down my pc while i'm a normal user instead of becoming root everytime (as I'm doing noe).

Thanks for the help!!!!

Last edited by spariggio82; 03-25-2005 at 04:39 AM.
 
Old 03-25-2005, 04:45 AM   #2
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
$man sudo

If you don't have it then add it from the slackware Packages. It's not installed by default.

Then edit you /etc/sudoers file

Add something like...

slack_user localhost = NOPASSWD: /sbin/shutdown
 
Old 03-25-2005, 05:01 AM   #3
spariggio82
Member
 
Registered: Apr 2004
Location: Camporotondo Etneo, Sicily
Distribution: SuSE 8.2 SuSE 9.1 Fedora C1 Slackware 10.1 Knoppix 3.9
Posts: 174

Original Poster
Rep: Reputation: 30
I have sudo man

Now I have to copy exactly the line you've suggested or I've to modify upon my system configuration????

Sorry for my dumb question
 
Old 03-25-2005, 05:06 AM   #4
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
Well yeah, copy the line except replace the user and machine name with your own of course. Using my user and machine name is doubtfull to help.
 
Old 03-25-2005, 05:22 AM   #5
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
If it fails, you need to edit /etc/sudoers file and add :
Code:
<your username>  <your hostname> = NOPASSWD: /sbin/shutdown -h now, /sbin/poweroff, /sbin/reboot
And to shut down your machine :
sudo /sbin/shutdown -h now

or:
sudo /sbin/poweroff

to reboot:
sudo /sbin/reboot

Note that the command have to be typed exactly as above, eg
sudo poweroff <-- will not work
 
Old 03-25-2005, 05:25 AM   #6
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
FYI, use the visudo program to edit the sudoers file. The line mentioned will exist but be commented.

%users localhost=NOPASSWD:/sbin/shutdown -h now

I inserted the NOPASSWD into a line that was already present in the sudoers file.
 
Old 03-25-2005, 05:29 AM   #7
chbin
Member
 
Registered: Mar 2005
Distribution: slackware-current
Posts: 379

Rep: Reputation: 31
Inserting the "-h now" is not neccessary... sudo allows you to pass whatever agruments you like.

shutdown -h now
shutdown -r now
shutdown whatever. doesn't matter.
 
Old 03-25-2005, 05:34 AM   #8
spariggio82
Member
 
Registered: Apr 2004
Location: Camporotondo Etneo, Sicily
Distribution: SuSE 8.2 SuSE 9.1 Fedora C1 Slackware 10.1 Knoppix 3.9
Posts: 174

Original Poster
Rep: Reputation: 30
Yes I saw it but I prefer leave these comments and examples and writing the line (as keefaz sug) using vi.

I've just edited the file but I cannot test it because I'm actually compiling some libraries and I have to wait
untili compiling ends!!!!


Thanks to all for you suggestions!!!!
 
Old 03-25-2005, 05:49 AM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,126

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Or if you're like me, and don't like all the typing, set up some alias's;
off, down, boot...

*Much* easier
 
  


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 to halt a system with private ip from a system in other net work seabark99 Linux - Networking 3 03-20-2005 08:36 AM
System going down for system halt NOW! (hangs) jdh77 Yoper 14 12-07-2004 03:28 AM
Automatic system rebbot stops installation linmix Yoper 0 11-15-2004 03:59 AM
Halt System Kaninchen Mandriva 5 05-11-2004 03:01 PM
Halt system kpraveen Linux - General 2 08-10-2002 08:40 AM

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

All times are GMT -5. The time now is 03:30 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