homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Microsoft / Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10)
Forum Library, Charter, Moderators: bill

Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10) Forum

Execute a DOS command on Windows from a remote Linux box?
On Windows Server 2003

 3:56 pm on Aug 24, 2007 (gmt 0)

Does anyone know how I can execute a DOS command on a Windows machine (for which I have the username and password of course ;) ) from a remote Linux box? This would be equivalent to ssh-ing in to a Linux machine from another one and executing a program.



 4:54 am on Aug 25, 2007 (gmt 0)

Telnet is one option but can be a bit of a hassle to setup. Another option would be to use a VNC client of some sort.

Microsoft now offers PsExec [microsoft.com] from their acquistion of Sysinternals.
Utilities like Telnet and remote control programs like Symantec's PC Anywhere let you execute programs on remote systems, but they can be a pain to set up and require that you install client software on the remote systems that you wish to access. PsExec is a light-weight telnet-replacement that lets you execute processes on other systems, complete with full interactivity for console applications, without having to manually install client software.


 5:30 am on Aug 30, 2007 (gmt 0)

Thanks for the suggestions bill.
Turns out (ironically) that it is possible to do it by setting up Cygwin to enable SSH logins, logging in via ssh, creating a batch file and then executing that batch file. You may or may not need to create the batch file but in my case it seemed to be necessary.

And use ssh-keygen to make ssh keys so that it doesn't prompt for a password, e.g.:

ssh-keygen -t rsa
(no passphrase)
ssh user@server "mkdir .ssh; chmod 700 .ssh"
scp .ssh/id_rsa.pub user@server:.ssh/authorized_keys2

This a nice hack to roll your own API when none is available ;)


 8:07 am on Aug 30, 2007 (gmt 0)

I totally forgot cygwin. <doh>
I run that on my home machines to maintain some personal websites. It's a powerful tool, but there's quite a learning curve if you're not familiar with the *nix command line.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Microsoft / Microsoft Windows OS (XP/NT/Vista/Windows 7/8/9/10)
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved