What is the simplest way to run a script remotely on Linux server from Windows without rsh?

Posted on 2004-09-02
Last Modified: 2010-05-18
Hi Experts,

     I am trying to run a script on a Linux server from windows.  I don't have rsh service available.  What's the most simple way to do this??  If possible, here's what i want:

a DOS batch file on windows that i just double click and then it will run the script on the linux server.

Thx a lot!!!
Question by:ericmhhui
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 11971020
Install a service in /etc/inetd.conf,  f.i.
<name>      stream  tcp     nowait  <username>    /usr/sbin/tcpd  /bin/bash -c /sbin/<yourscript>

Assign a port/protocol in /etc/services:
<name>      <portnumber>/tcp

restart inetd: killall -HUP inetd

Now all you have to do is to make a tcp connection to that portnumber. This can be done f.i. by your browser or telnet.

Author Comment

ID: 11972626
Hi bobqunzel,

     I don't have administrator rights.  Is there some other way to do this?  All I have is ftp from the windows command prompt, telnet and ssh.  Is there a way to write a ssh script or telnet script?  I am not too famaliar with this, but I cannot use anything that requires administrative rights to setup.


Accepted Solution

stanford_16 earned 50 total points
ID: 12006176
You can absolutely write a script via ssh, assuming you have an acccount on the Linux server (doesn't have to be root, by the way).

There are two ways to do this, based upon the complexity of the script that you wish to write.  The best way is as such:

Log on to the Linux server via SSH.  This doesn't require administrative priviledges on either system, just a simple login.  Using your favorite editor, write your script.  If the script is already written, you can use FTP or SFTP to copy the file.

Let's assume that you have Putty, plink, pscp, and puttygen on the Windows system:
(You can download all of these tools here):

Assuming you need to write the script:

1.  In Putty, type the IP address or hostname of the Linux server, and select SSH.  Click on "Open"

2.  Log into the Linux server with your username and password.

3.  Type your script in your favorite editor.

Assuming you need to copy the script over from the Windows system:

1.  Start -> Run -> "cmd" <Enter>
2.  c:\> ftp <IP Address of Linux Server>  and login
3.  ftp>  put <local file>

Now that the script is on the system, we need to set up the DOS script.

There are two ways to do this; using a password, and using a key (recommended)

Once the script is in your home directory, you can use putty in a DOS batch script to execute the script like so:

First, fire up puttygen.  Create an SSH2 RSA key.  Save it somewhere that is easy for your batch script to find.
You'll notice a window at the top that says "Public key for pasting into OpenSSH".  Copy that to the linux server as this filename:

This allows you to connect to the server without a password.

Next, write your DOS batch script.  It will look like this:

@echo off
...\plink.exe --ssh -i D:\PATH\TO\SSH\KEY  root@HOST  ./my_script

This should get you started.  Good luck!

Author Comment

ID: 12006246

Is plink and puttygen separate programs from putty?

and from
...\plink.exe --ssh -i D:\PATH\TO\SSH\KEY  root@HOST  ./my_script
i am not the root account, can i do username@HOST instead??


Expert Comment

ID: 12006324
Sorry about the root, yes, you can use username@HOST.

Also, if you click on the link in my last post, you will find plink and puttygen (which are separate programs from putty).


Featured Post

Manage your data center from practically anywhere

The KN8164V features HD resolution of 1920 x 1200, FIPS 140-2 with level 1 security standards and virtual media transmissions at twice the speed. Built for reliability, the KN series provides local console and remote over IP access, ensuring 24/7 availability to all servers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit If you want to manage em…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question