LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (https://www.linuxquestions.org/questions/linux-networking-3/)
-   -   remote shutdown (https://www.linuxquestions.org/questions/linux-networking-3/remote-shutdown-412530/)

yvesg 02-07-2006 05:28 AM

remote shutdown
 
Hello

I have a linux system (Suse 9.3) and a Windows 2003 server.
Is it possible to remotely shutdown the linux via the 2003 server ?
The reason why I'm asking this is that the 2003 server has UPS management software installed on it. And at power failure it automaticly shuts down the server. But I also need to shutdown the linux box.
Any solutions ?

Sargek 02-07-2006 05:41 AM

Try webmin - you install it on the GNU/Linux box then access it via the browser on the winblows box. It allows remote system administration, shutdown, etc.

bathory 02-07-2006 05:45 AM

Install ssh in your linux box and setup sshd allowing root to connect without using a password (i.e. using keys). Then install putty in Windows and when you want to shutdown Linux you can use plink (putty command line):
Code:

plink root@linux-box /sbin/poweroff

nx5000 02-07-2006 05:50 AM

You can create a linux user remshutdown. Change its default shell to shutdownscript.
In this script put
Code:

sudo /sbin/halt ; sleep 3; exit
You have to configure sudo so that remshutdown is alowed to launch /sbin/halt.

Install ssh on the linux box.
On the windows machine, use putty to ssh-login to the linux box as remshutdown. Putty has to be called when UPS goes down.

And give remshutdown a good password ;)

card-suse 02-07-2006 07:17 AM

I just ssh and pass a command like this:

Code:

ssh root@(your machine name here) shutdown -h -t 10 now
Do it every night. Hope this helps.

nx5000 02-07-2006 07:34 AM

If a cracker breaks in your first box, he will be very happy that you have set up root access on the second box.

I would use bathory's method with a non priviledge user!!

Darin 02-07-2006 12:58 PM

Quote:

Originally Posted by bathory
Install ssh in your linux box and setup sshd allowing root to connect without using a password (i.e. using keys)....

To expand on nx5000's message, do NOT set up root ssh access, with or without keys or strong passwords, on your linux box.

It is quite easy to make a new user (name it remshutdown like he suggested, or name it whatever you want) with a strong password or key who ONLY has sudo access to shutdown the system. It's also not too hard to get an ssh client to run a pre-configured script, which I assume you want to do since the shutdown will probably need to be a non-interactive command run by the UPS software on the 2K3 box. From there it's just a matter of making sure the ssh server is [installed and] running and picking which ssh client for Windows you want to use.

bathory 02-07-2006 04:05 PM

Both nx5000 and Darin are right about security
You can use your normal user account to halt/poweroff the linux box channging the setuid bit of halt if you don't want to mess with sudo. Just:
Code:

chmod u+s /sbin/halt

card-suse 02-08-2006 07:10 AM

I like all these strategies, but I simply have to ask the question: Where is the big security faux-paus in ssh as root to a machine? I'm not trying to be antagonistic, I really want to understand this. Let me setup the situation in a little more detail.

1) Do not use keys for authorization. I still use a password authentication for ssh. I'm just using ssh for an encrypted connection (no keystroke monitoring and such).

2) Have a good host.allow and host.deny setup regardless.

3) All activitiy is happening behind a pretty good firewall.

Are you simply saying that you should never have the ability to login as root on any machine? I don't see the difference between a hacker accessing one of your machines because a user has poor password techniques and then getting lucky and figuring out roots amazing password and switching to root.:) He can also ssh to another machine that may have the same bad user, logging in as that user and hope that root set his password the same (which this root doesn't). Again, I'm not being antagonistic, I just want to know the issue here. Thanks a bunch. All the best....


All times are GMT -5. The time now is 07:49 PM.