Welcome to WebmasterWorld Guest from 50.19.0.90

Forum Moderators: bakedjake

Message Too Old, No Replies

Shut down or reboot without SUDO

     
8:20 am on Oct 26, 2007 (gmt 0)

Junior Member

10+ Year Member

joined:Oct 23, 2003
posts: 103
votes: 0


My dedicated server needs a few more GB of RAM, and i want the co-location company to shut down the server nice in order to do the maintenance.

Is there a way to give the server guys a command to shut down the server nice without giving them root access?

12:45 pm on Oct 26, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 11, 2003
posts:5063
votes: 11


I would hope not.

You're best bet is to have them call you when they're ready to do. You log in, shut it down, they can install the memory and bring it back up. You should be monitoring during this process anyway to make sure the server comes back online.

6:29 pm on Oct 27, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member jtara is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Nov 26, 2005
posts:3041
votes: 0


Give the vendor a non-privileged user account, and see if setting the SUID bit on "shutdown" will do the trick.

It would be prudent to remove the "rx" permissions for "others", and do a "chgrp" on "shutdown" from "root" to some new group. (For example, you might call the new group.... "shutdown".) Put the vendor's account in that group.

3:22 am on Oct 30, 2007 (gmt 0)

Preferred Member

10+ Year Member

joined:Dec 30, 2003
posts: 428
votes: 0


If you're running RedHat, /etc/pam.d/halt controls who can halt the box without root access. By default the user at the console can halt the box.

It works without setuid'ing the shutdown binary, I've never looked into how, but it does work.

edit: I took a quick search and it's done through /usr/sbin/userhelper

Sean

[edited by: SeanW at 3:25 am (utc) on Oct. 30, 2007]

12:03 am on Oct 31, 2007 (gmt 0)

Senior Member

WebmasterWorld Senior Member wheel is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:Feb 11, 2003
posts:5063
votes: 11


By default the user at the console can halt the box.

I think I'd forgotten that. Seems odd that this is the case, though I guess if you've got physical access you're not far from the power cord anyway.

I can tell you that 'shutdown -h now' in an ssh terminal session on your server looks almost exactly like the same command on a terminal session on your linux desktop. It looks enough alike that one might shut down some webservers at the datacenter thinking they were shutting down their local pc :).