[Tutor] Remote access from Windows PC to a Linux box

Lie Ryan lie.1296 at gmail.com
Wed Mar 31 03:40:36 CEST 2010


On 03/31/2010 03:29 AM, Mike Baker wrote:
> Hi,
>  
> I'm trying to connect to a Linux box from my Windows machine and execute
> a series of commands - (ls, pwd, cat 'somefile', etc...).   I'm using
> Putty to do the ssh and have set up with Putty's Pagent agent to allow
> me to enter a passphrase once per session to handle security keys
> between the two boxes (so, no passwords needed for my remote scripts).
>  
> I have code that will give me a remote prompt on the Linux machine where
> I can manually enter commands. This works great, but I want a script to
> always execute the same series of commands without having to do so
> manually..   I also have code that will execute a single command like
> cat a file and write the ouput to a new file. However, when I try to use
> the communicate object in subprocess, my window hangs. 
>  

Seeing your case, probably a simple shell script on the server side
would be an easier option. Whenever you ssh to the server, you just
execute this startup script. You may also be able to configure putty to
execute this script automatically, though since I never used putty I
don't know if putty can do that. Or alternatively, you can create a
.bashrc (or whatever the remote box's terminal default startup script is).



More information about the Tutor mailing list