LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-07-2013, 10:25 AM   #1
firewallengineer
LQ Newbie
 
Registered: Jul 2013
Posts: 19

Rep: Reputation: Disabled
How to shutdown linux machine remotely from windows machine with a batch script?


Hi all, I’ve a few linux machine in my virtualbox+gns network and need to shutdown all machine properly in each session.
I found this quite tedious and would appreciate if you could share any script to shutdown linux machine remotely from windows machine.

Currently, I’m able to login remotely with putty or plink.

Quote:
C:\plink.exe -ssh root@<ip address> -pw password
C:\putty.exe -ssh root@<ip address> -pw password
Unfortunately, I’m not sure how to send “shutdown/halt” command to this machine.

Any help would be highly appreciated. Thanks.
 
Old 12-07-2013, 05:43 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,114

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
ssh user@server "shutdown -h now"
 
1 members found this post helpful.
Old 12-07-2013, 06:24 PM   #3
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 6,002

Rep: Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612Reputation: 1612
To add to the above if you set up SSH to use keys instead of a password you won't need to have the password stored in a script.
 
Old 12-07-2013, 09:26 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 15,374

Rep: Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198Reputation: 2198
Could use autoexpect or expect to create a script.
 
Old 12-07-2013, 11:38 PM   #5
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD
Posts: 2,114

Rep: Reputation: 330Reputation: 330Reputation: 330Reputation: 330
Quote:
Originally Posted by jefro View Post
Could use autoexpect or expect to create a script.
There is no interaction necessary, so you don't need "expect".
 
Old 12-07-2013, 11:50 PM   #6
FAN13
LQ Newbie
 
Registered: Dec 2013
Posts: 1

Rep: Reputation: 0
Oh this helped a lot.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
How to remotely hibernate Windows machine Scory Linux - General 7 12-03-2013 12:08 PM
How to run a script to a remote linux machine from a windows machine squirrel001 Linux - Newbie 5 05-04-2009 07:06 PM
how to shutdown,restart and log off windows machine remotely through a linux machine deepak rawat Fedora 1 05-23-2006 02:25 AM
How can connect to Linux remotely from a Windows machine? imsam Linux - Networking 2 07-27-2004 10:01 PM
need to run a server remotely from a windows machine klintonray Linux - Software 3 04-18-2003 06:33 PM


All times are GMT -5. The time now is 10:49 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration