Turning Linux Server Off remotely

Posted on 2006-11-02
Last Modified: 2010-04-20
Hi experts.

My company purchased a nobreak that have the ability to turn off the computer when the batery charge gets critical. This job is done using the Nobreak's software (Upsilon 2000), that is installed on Windows server.

My enviroment have 6 servers: 1 Windows 2003 Server and 5 SuSE Linux Enterprise Server.
The Nobreak's software have the ability to call an application when it starts the shutdown sequence. So, my ideia is to develop an small aplication that will connect to the Linux Serves and inform them to start a shutdown operation but I have no ideia of how this could be implemented on my Linux servers...

Does anybody have any advice?
Thanks a lot.
Question by:regisdaniel
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 43

Accepted Solution

ravenpl earned 168 total points
ID: 17858317
configure passwordless ssh connection from Your windows box to all linux boxes.
On Windows shutdown call each linux and remotely run /sbin/poweroff

Windows ssh client

Not You have to run /sbin/poweroff as root user.
Or You could configure new user for that purpose, that allow him to execute /sbin/poweroff with root privs via sudo.
LVL 30

Assisted Solution

by:Kerem ERSOY
Kerem ERSOY earned 166 total points
ID: 17863316

Your software might be able to remotely shutdown other systems. Please consult your product manual.

logon to your remote system that you want to shutdown remotely as root

issue this command:
groupadd shutdown

useradd  -g shutdown rmtsht
passwd rmtsht

(Enter a password for the account or it ill be login disabled)

now issue this command:

and add this line in the file

%shutdown ALL=(root) NOPASSWD: /sbin/

Save and quit. (don't forget to press enter after the line before saving.)

Edit /sbin/

enter these lines in it:

#! /bin/sh
/sbin/shutdown -h now

Save and quit. Issue:

chmod 500 /sbin/

Now edit /home/rmtsht

and add this line at the end:

sudo /sbin/

Save and quit.

Now ensure "passwordless-ssh" as ravenpl indicated.

Now when you launch with rmtsht user like that:

C:\path\to\putty -ssh rmtsht@IP_TO_SHUTDOWN

it will shutdown the system.



Assisted Solution

paradoxengine earned 166 total points
ID: 17877862
make sure that the user will only be able to run that command (ssh will allow you to set it running at login instead of /bin/bash or other shells): improved security is always good ;)
LVL 30

Expert Comment

by:Kerem ERSOY
ID: 17878134
>Now edit /home/rmtsht
Ooops sorry the line above must read:

Now edit /home/rmtsht/.bash_profile

if you want t further restrict this user to run only this script.

- change to user home directory.
- create a shell file called rmtsh and add these lines in it:
#! /bin/sh
sudo /sbin/

- Save and exit
- chmod 500 rmtsh
- if you created the file as root issue this command too:
  chown rmtsht.shutdown rmtsh
- issue this comand as root:
chsh rmtsht
- after the
New shell [/bin/bash]:
prompt enter the new shell as :
- Ignore the warning - Observe the
Shell changed
if you want you can also
chmod 750 /home/rmtsh

so that only rmtsh and users in shutdown group (read-only) could see the ccontent of this directory.

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question