LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
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, 09: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, 04:43 PM   #2
haertig
Senior Member
 
Registered: Nov 2004
Distribution: Debian, Ubuntu, LinuxMint, Slackware, SysrescueCD, Raspbian, Arch
Posts: 2,331

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

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
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, 08:26 PM   #4
jefro
Moderator
 
Registered: Mar 2008
Posts: 21,980

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

Rep: Reputation: 357Reputation: 357Reputation: 357Reputation: 357
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, 10:50 PM   #6
FAN13
LQ Newbie
 
Registered: Dec 2013
Posts: 1

Rep: Reputation: 0
Oh this helped a lot.
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:14 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