LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 02-07-2006, 05:28 AM   #1
yvesg
Member
 
Registered: May 2004
Distribution: SuSe v9.3 Professional
Posts: 33

Rep: Reputation: 15
Question 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 ?
 
Old 02-07-2006, 05:41 AM   #2
Sargek
Member
 
Registered: Jan 2003
Location: San Antonio, Texas
Distribution: Debian testing
Posts: 416

Rep: Reputation: 36
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.
 
Old 02-07-2006, 05:45 AM   #3
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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

Last edited by bathory; 02-07-2006 at 05:46 AM.
 
Old 02-07-2006, 05:50 AM   #4
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
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
 
Old 02-07-2006, 07:17 AM   #5
card-suse
Member
 
Registered: Dec 2005
Location: Ohio, USA
Distribution: OpenSuSE 10.2
Posts: 74

Rep: Reputation: 15
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.
 
Old 02-07-2006, 07:34 AM   #6
nx5000
Senior Member
 
Registered: Sep 2005
Location: Out
Posts: 3,307

Rep: Reputation: 57
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!!
 
Old 02-07-2006, 12:58 PM   #7
Darin
Senior Member
 
Registered: Jan 2003
Location: Portland, OR USA
Distribution: Slackware, SLAX, Gentoo, RH/Fedora
Posts: 1,024

Rep: Reputation: 45
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.
 
Old 02-07-2006, 04:05 PM   #8
bathory
LQ Guru
 
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,163
Blog Entries: 1

Rep: Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032Reputation: 2032
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
 
Old 02-08-2006, 07:10 AM   #9
card-suse
Member
 
Registered: Dec 2005
Location: Ohio, USA
Distribution: OpenSuSE 10.2
Posts: 74

Rep: Reputation: 15
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....
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
remote shutdown scott4957 Linux - Software 2 11-15-2005 11:00 PM
Remote shutdown mrbabis Linux - Newbie 3 10-26-2005 08:46 AM
Remote shutdown? Zinghung Linux - Networking 7 07-08-2005 06:59 AM
Remote Shutdown? [LAG] Prude Linux - Networking 7 02-27-2005 08:08 PM
Remote shutdown Tarantismic Yak Linux - Security 1 06-04-2001 09:35 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 08:57 PM.

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