Welcome to WebmasterWorld Guest from 54.211.101.8

Forum Moderators: bill

Execute a DOS command on Windows from a remote Linux box?

On Windows Server 2003

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

WebmasterWorld Senior Member 10+ Year Member



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)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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)

WebmasterWorld Senior Member 10+ Year Member



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.
See:
[pigtail.net...]

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)

WebmasterWorld Administrator bill is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month



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.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month