LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 12-20-2003, 05:13 PM   #1
cblamer
LQ Newbie
 
Registered: Dec 2003
Posts: 27

Rep: Reputation: 15
normal user running shutdown


if possible looking for a way to have a normal user be able to run shutdown, and reboot commands. Now since i am root, and user, and the only user i could just use su or something the do the commands if that the easiest way.

any help would be great
thanks
chris
 
Old 12-20-2003, 06:39 PM   #2
Kristijan
Member
 
Registered: Sep 2003
Location: Melbourne, Australia
Distribution: NetBSD 3.0.1, Slackware 10.1
Posts: 394

Rep: Reputation: 30
man sudo

and take a read of that, if your still stuck, just post back.
 
Old 12-21-2003, 01:55 AM   #3
cblamer
LQ Newbie
 
Registered: Dec 2003
Posts: 27

Original Poster
Rep: Reputation: 15
ok thanks, figured it out

so if i am doing this right, i would be typing "su /sbin/shutdown -h now"?
if that correct then another question, can i create a script called say "killpc" in pc home bin dir that contains that command line, that would make less typing?

im thinking it woud work but what do i know?

chris
 
Old 12-21-2003, 04:56 AM   #4
core
Member
 
Registered: May 2003
Location: Berlin
Distribution: Slackware 9.1 Kernel: 2.6.4
Posts: 60

Rep: Reputation: 15
No, using su, it would be su -c "/sbin/shutdown -h now"
But you can just press CTRL+ALT+DEL to reboot
And sudo is not su. with sudo you can specify a user and a given program that the user can run as root wiithout entering a password..


f.e. as root
visudo
then find the line where is:
# User privilege specification
root ALL=(ALL) ALL

And below that you can add your entry... f.e. allowing user foobar to execute shutdown without passwd:
foobar ALL=NOPASSWD:/sbin/shutdown



now foobar can just enter "sudo /sbin/shutdown -h now" and he must not enter a passwd..
for lazyness, you could add an alias to your .bashrc or .bash_login, say
alias shutdown='sudo /sbin/shutdown -h now'
re-login and 'shutdown'
 
Old 12-21-2003, 05:15 AM   #5
cblamer
LQ Newbie
 
Registered: Dec 2003
Posts: 27

Original Poster
Rep: Reputation: 15
actualy when i wrote that it was supposed to be a sudo, not su. guess thats what i get for not proofreading eh?

thanks though extermely helpful
chris
 
Old 12-21-2003, 06:57 AM   #6
minio
Member
 
Registered: Sep 2003
Location: Czech Republic - Prague
Distribution: Slackware 9.1
Posts: 61

Rep: Reputation: 15
I find out other way how to do this. You need a "pam" package and "usermode" package, both you can download from dropline http://sourceforge.net/project/showf...group_id=62166 . Install them and you will be able use halt and reboot as user. If you really need shutdown command then do "ln -s consolehelper shutdown", "cp /etc/pam.d/halt /etc/pam.d/shutdown" and "cp /etc/security/console.apps/halt /etc/security/console.apps/shutdown". Then as a user you can try to type "shutdown -h now"
 
Old 12-21-2003, 08:44 PM   #7
Kristijan
Member
 
Registered: Sep 2003
Location: Melbourne, Australia
Distribution: NetBSD 3.0.1, Slackware 10.1
Posts: 394

Rep: Reputation: 30
As for the killpc, you could try make an alias in you ~/.bashrc

(eg: your ~/.bashrc file)

Code:
alias killpc='sudo shutdown -h now'
If you dont have a ~/.bashrc just create one.

Save that in ~/.bashrc, and exit to your CLI

Then just

Code:
source ~/.bashrc
And give it a test run

Last edited by Kristijan; 12-21-2003 at 08:47 PM.
 
  


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
Running super user commands as normal user mickyg Linux - Security 5 10-14-2005 07:25 PM
can normal user use shutdown command? sorno Linux - Newbie 2 07-30-2005 06:11 AM
can normal user do shutdown? TheOneAndOnlySM Slackware 12 12-17-2003 11:10 PM
Disable reboot/halt/shutdown as normal user carstenbjensen Mandriva 4 09-09-2003 11:42 AM
Normal User Restart and Shutdown InsaneBob Linux - Software 2 08-23-2003 05:47 PM

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

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

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