LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 10-31-2004, 03:06 PM   #1
TimmyP
Member
 
Registered: Dec 2003
Location: Newark, DE
Distribution: Debian "sarge"
Posts: 50

Rep: Reputation: 15
regular users using halt


back a few months ago when i was running mandrake 9.1, any user on my computer was able to open a command prompt and issue the halt, reboot, and shutdown commands. after switching to debian, those commands are reserved for the su.

i tried copying "halt" and "reboot" to /usr/bin and changing the permissions (...it made since at the time) but i had no luck.

thanks for your help.

TimmyP
 
Old 10-31-2004, 07:13 PM   #2
ToniT
Senior Member
 
Registered: Oct 2003
Location: Zurich, Switzerland
Distribution: Debian/unstable
Posts: 1,357

Rep: Reputation: 47
Code:
chmod u+s /sbin/halt
 
Old 10-31-2004, 07:39 PM   #3
McCloud
Member
 
Registered: Sep 2004
Distribution: Debian Etch
Posts: 179

Rep: Reputation: 30
Install the SUDO package. With SUDO you can define which users/groups are allowed to run certain commands (you can specify the commands) with different (for example root) permissions. You can even specifiy whether they have to enter a password when they execute a certain command.

I had the problem that I had to switch to my root account to shutdown my pc. Now I can just type "sudo shutdown -h now" in my user account.

Do a Google search on 'sudo' to find more information.
 
Old 10-31-2004, 10:09 PM   #4
Dead Parrot
Senior Member
 
Registered: Mar 2004
Distribution: Debian GNU/kFreeBSD
Posts: 1,597

Rep: Reputation: 46
Setting User ID for /sbin/halt, like ToniT suggests, allows you to shutdown your computer as normal user using the "halt" command (and you can reboot with Ctrl-Alt-Del). But just for the fun of it, here's how to use Sudo to achieve the same thing:

First, you'll probably want to use nano as your system's default text editor. Do "update-alternatives --config editor" and choose nano's number from the list. Then edit ~/.bash_profile and add these two lines:
Code:
EDITOR=nano
export EDITOR
And while you're editing ~/.bash_profile, you can also add some command aliases:
Code:
alias   halt="sudo /sbin/halt"
alias   reboot="sudo /sbin/reboot"
Then logout and login again so that the changes in ~/.bash_profile take effect.

Next, "su" to root, do "apt-get install sudo" to install the Sudo package, and then type "visudo". Now the /etc/sudoers file should open in nano. Type the following line to the bottom of that file (replace "username" with your username):
Code:
username   ALL = (ALL) NOPASSWD: /sbin/halt, /sbin/reboot
Then exit nano saving changes. After doing this you should be able to use the "halt" command as normal user to shutdown computer and the "reboot" command to reboot.

Last edited by Dead Parrot; 10-31-2004 at 10:14 PM.
 
Old 11-08-2004, 03:06 AM   #5
TimmyP
Member
 
Registered: Dec 2003
Location: Newark, DE
Distribution: Debian "sarge"
Posts: 50

Original Poster
Rep: Reputation: 15
thank you for your help, i ended up going with the sudo method.

thanx again


TimmyP
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 sort regular users and system users from /etc/passwd joeyBig Red Hat 9 05-29-2008 12:59 AM
letting users halt the system dasy2k1 Linux - Newbie 3 10-15-2005 01:55 AM
All users can halt system Equin Linux - Security 2 10-17-2004 01:15 PM
halt or poweroff permission for users salahuddin_66 Slackware 6 04-23-2004 04:13 AM
change permissions for regular users... questionasker Linux - General 6 01-26-2004 01:07 PM

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

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