LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-29-2007, 03:24 PM   #1
iron_toupee
LQ Newbie
 
Registered: Oct 2007
Posts: 4

Rep: Reputation: 0
Question reboot by a non-root user?


is it possible to set a script to run as root and not prompt for the root password? could i hide the root password and access it from a script?

i would like to set up my machine so its able to be rebooted by a non-root user. is this even possible in linux?
 
Old 10-29-2007, 03:38 PM   #2
samthakur
LQ Newbie
 
Registered: Oct 2007
Posts: 12

Rep: Reputation: 0
Non-root user can reboot the PC (even can do anything that root can), but the condition is that user must know the 'root password'. With root password, normal users can have all the privileges of root.
 
Old 10-29-2007, 03:42 PM   #3
farslayer
LQ Guru
 
Registered: Oct 2005
Location: Northeast Ohio
Distribution: linuxdebian
Posts: 7,249
Blog Entries: 5

Rep: Reputation: 191Reputation: 191
http://wiki.linuxquestions.org/wiki/Shutdown
 
Old 10-29-2007, 03:56 PM   #4
iron_toupee
LQ Newbie
 
Registered: Oct 2007
Posts: 4

Original Poster
Rep: Reputation: 0
Wink

thanks guys, i also found the following solution here and it worked well for my purposes.
http://www.bostream.nu/stdf/linuxtips/00000059.html


Shutdown for non-root users

Allowing non-root users to shutdown a Linux box.

1. As root create a group shutdown.
#addgroup shutdown

2. Put /sbin/shutdown into the group shutdown.
#chown root.shutdown /sbin/shutdown

3. Change accessrights to make /sbin/shutdown setuid and disallow
other users from executing shutdown.
#chmod 4754 /sbin/shutdown

4. Make a link from /bin/shutdown to /sbin/shutdown
#ln -s /sbin/shutdown /bin/shutdown

Now anyone belonging to the group shutdown can execute shutdown but I just will
allow the person in control of the keyboard to be able to issue the shutdown
command. You might prefer something else.

For the following to work you need to have "shadow password" installed but I
believe most have it.

5. Edit the file login.defs. Near the end of this file locate the line
#CONSOLE_GROUPS floppy:audio:cdrom
Remove the hashsign and add the group shutdown to this line and you get:
CONSOLE_GROUPS floppy:audio:cdrom:shutdown

Thats it. Everyone logged in via the console will belong to these groups so
you need not add anyone to them. I believe this is better than to just add
users to the group shutdown.
 
Old 10-29-2007, 03:57 PM   #5
Hangdog42
LQ Veteran
 
Registered: Feb 2003
Location: Maryland
Distribution: Slackware
Posts: 7,803
Blog Entries: 1

Rep: Reputation: 422Reputation: 422Reputation: 422Reputation: 422Reputation: 422
Quote:
Originally Posted by samthakur View Post
Non-root user can reboot the PC (even can do anything that root can), but the condition is that user must know the 'root password'. With root password, normal users can have all the privileges of root.
It probably is rather poor practice to pass the root password around to all users. The preferred way is to use sudo to give normal users root access to specific commands like shutdown.
 
Old 10-29-2007, 04:00 PM   #6
samthakur
LQ Newbie
 
Registered: Oct 2007
Posts: 12

Rep: Reputation: 0
Thanks for the useful info Dude.....
 
Old 10-30-2007, 02:06 AM   #7
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,398

Rep: Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780Reputation: 2780
Actually, just use the sudo tool to give the user specifically the ability to shutdown and nothing else.
It's exactly the sort of problem sudo was designed to solve.
 
  


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
halt/reboot as a non-root user Pau Gasol Slackware 3 10-05-2007 11:47 AM
RHEL3 Mounting USB after reboot and between reboots: root and non-root users Luis Nunes Linux - Hardware 0 07-20-2005 08:32 AM
After reboot I can only log in as root RemusX2 Linux - General 3 12-25-2004 11:01 PM
How to allow certain non-root users to reboot?? jdaniel Linux - General 2 09-06-2004 10:05 AM
Can only reboot or halt as root Kernel 2.6.5 Slackware 2 05-20-2004 08:07 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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