LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-28-2004, 12:40 AM   #1
jagadee76
LQ Newbie
 
Registered: Dec 2004
Location: bangalore, India
Distribution: RHAS 2.1
Posts: 3

Rep: Reputation: 0
I want to grant 'shutdown' previlege to a non-root user to do directly from console


I want to grant 'shutdown' privilege to a non-root user to to shutdown directly from the linux 2.1 console. I can able to do it via network login using 'sudo'

Please advise

Thanks in advance


Last edited by jagadee76; 12-28-2004 at 12:41 AM.
 
Old 12-28-2004, 12:51 AM   #2
kilgoretrout
Senior Member
 
Registered: Oct 2003
Posts: 2,986

Rep: Reputation: 388Reputation: 388Reputation: 388Reputation: 388
Change the permissions on shutdown like so:

# chmod 755 /sbin/shutdown
 
Old 12-28-2004, 01:46 AM   #3
heema
Senior Member
 
Registered: Sep 2003
Location: Egypt
Distribution: Arch
Posts: 1,528

Rep: Reputation: 47
or you can put in sudoers file the option without password.
after that, you call shutdown.
Open a root terminal and type `visudo'. This will open the config file for sudo.

bob ALL=(ALL) NOPASSWD:/sbin/shutdown
 
Old 12-28-2004, 02:25 AM   #4
jagadee76
LQ Newbie
 
Registered: Dec 2004
Location: bangalore, India
Distribution: RHAS 2.1
Posts: 3

Original Poster
Rep: Reputation: 0
Hi,

I'm getting the error after changing the permission to 755

Here are my steps:

#chmod 755 shutdown
#ls -la shut*
-rwxr-xr-x 1 root root 15488 Jun 26 2003 shutdown
# su - oracle
$ /sbin/shutdown
shutdown: you must be root to do that!
$ /sbin/shutdown -a
shutdown: you must be root to do that!
 
Old 12-28-2004, 06:48 AM   #5
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 269Reputation: 269Reputation: 269
Quote:
Originally posted by jagadee76
Hi,

I'm getting the error after changing the permission to 755

Here are my steps:

#chmod 755 shutdown
#ls -la shut*
-rwxr-xr-x 1 root root 15488 Jun 26 2003 shutdown
# su - oracle
$ /sbin/shutdown
shutdown: you must be root to do that!
$ /sbin/shutdown -a
shutdown: you must be root to do that!
This is exactly why you should just setup sudo instead, there's more involved than just changing the permissions of the command.

Regards.
 
Old 12-28-2004, 10:14 PM   #6
me23askdf
LQ Newbie
 
Registered: Dec 2004
Posts: 4

Rep: Reputation: 0
I, too, like the sudo approach because you can grant access to specific commands to only certain users, and can even specify the exact command line that they can run. However, chmod 4755 works. The 4 sets the set-user-id on execution bit. Then, since this command is owned by root, when a non-root user runs the shutdown command, they run it with the same identity as root. On a multiple user system this would be bad since anyone could now shut the system down, so this is definitely a case where sudo is better.
 
Old 12-29-2004, 03:16 AM   #7
jagadee76
LQ Newbie
 
Registered: Dec 2004
Location: bangalore, India
Distribution: RHAS 2.1
Posts: 3

Original Poster
Rep: Reputation: 0
Hi,

Thanks to everyone for your effort.

The following steps did the trick:
-------------------------------------
1. Create shutdown.allow file under /etc
2. Add the non-root user who wants to perform shutdown in that file
3. Login in as that user
4. $/sbin/shutdown -a -h now

Please let me know if these steps are right
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
shutdown with a not root user krusty_lab AIX 2 10-18-2005 06:07 PM
Can't shutdown as any user but root? JustinCoyan Slackware 4 06-10-2004 01:05 PM
grant user "shutdown -h now" mcshen Linux - Newbie 3 01-11-2004 01:30 PM
how can i allow a power user 2 shutdown linux boz from console poweroff Linux - General 7 10-16-2003 09:22 AM
how to allow a not root user to shutdown ethanchic Linux - General 9 06-18-2002 05:08 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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