Auto login to Unix

Hi,

i am trying to connect to unix server from windows bat file using telnet command. But bat file is unable to pass username and password hence could not login to UNIX.

My requirement is to connect UNIX server from .bat file and run few macros at a perticular schedule. My UNIX login does not have the access to use crontab hence i am going for windows bat files.

I googled a lot to get the answer for - how to connect UNIX from windows bat file but not getting any proper answer.

I tried with putty as well -

putty.exe -ssh ServerName.COM -l UserName -pw MyPassword -m cmd.sh

but still its not working

Plz help!!

Thankx in advance.

Further to the answer you were given last year.
http://www.unix.com/windows-dos-issues-discussions/111739-bat-file-connect-unix-server.html

We could be more specific if you state which version of Windows and which version of unix.
The general solution is to use Windows "rsh" which is specifically for running unix commands on a unix server from a Windows command prompt (or Windows Batch File). Check with your Network Administrator whether remote shell is allowed in your security policy.

You will find many methods described on the Internet to get Windows rsh to work. Here is the simplest.

1) Choose a user on the unix server "unixserver" to host the commands. "unixuser".
Do not use "root" because this is inherantly insecure.
2) Note the username you use to log into you PC. "dosuser".
3) Create (or add to) a .netrc file in the home directory of "unixuser" with permissions 600 owned by "unixuser" and containing:

ip_address_of_pc dosuser

On some systems where we have IP address above it has to be fully qualified host name which you can find out by issuing "who -R am i" from a telnet session from the same PC.

4) Test rsh from the Windows command prompt. For example run unix command "pwd".

rsh unixserver -l unixuser -n pwd

Interestingly the obvious command to try is "who am i" but this will not work because "rsh" does not have a terminal context.

The command to be executed from rsh could be a shell script containing thousands of commands.