Shut down or reboot without SUDO

ning

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?

wheel

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

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.

jtara

6:29 pm on Oct 27, 2007 (gmt 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.

SeanW

3:22 am on Oct 30, 2007 (gmt 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]

wheel

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

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 :).