Operating System - Microsoft
1748285 Members
4008 Online
108761 Solutions
New Discussion юеВ

how to provide password in case of batch files(ssh protocol)

 
ManojKumar
Advisor

how to provide password in case of batch files(ssh protocol)

Hi all,

I m new to this forum .
Need to know the procedure to provide the password in case of batch files , also i m working on ssh protocol .
What i m trying is given below::

IF "%1"=="" GOTO :END
SET PASSWD=%1
CALL otherbat
:END
REM maybe echo a warning that everything else will not work properly
REM because of a missing password

OTHERBAT.BAT

echo %PASSWD%| ssh root@
OR
echo "PASSWD">ssh IP -l root

Problem:: It is not accepting the password, everytime i m supposed to enter the same manually .

regards,
manoj
11 REPLIES 11
Yogeeraj_1
Honored Contributor

Re: how to provide password in case of batch files(ssh protocol)

hi manoj,

have a look at this thread:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=190528


hope this helps!

kind regards
yogeeraj
No person was ever honoured for what he received. Honour has been the reward for what he gave (clavin coolidge)
ManojKumar
Advisor

Re: how to provide password in case of batch files(ssh protocol)

Hi,

actually i don't want to disable the password prompt .
Also, i want to use the same in windows .

Need to know the procedure to provide the password .

regards,
manoj
Jean-Yves Picard
Trusted Contributor

Re: how to provide password in case of batch files(ssh protocol)

Hello,

((insert lecture about hard coded password here))

I couldn't tell if you start you client from Unix or DOS.

I haven't seen any way to send password from Unix.

however if you are using putty,
there is a -pw option which might help you.

Jean-Yves Picard
Michael Selvesteen_2
Trusted Contributor

Re: how to provide password in case of batch files(ssh protocol)

Hi,

Like FTP, SSH will not accept password from a batch file. My suggestion is to set up public key authentication between those machines. Else if security of your password is not a concern for you, then an expect script can automate your ssh login.

A simple search in this forum about public key authentication will result in number of threads explaining how to set up public authentication.

Also you can try man ssh, scp and sftp
ManojKumar
Advisor

Re: how to provide password in case of batch files(ssh protocol)

Hi,

It' really nice to hear from u guys-- .

Actually i don't want to use any tool like putty, cygwin, SSHSecureShellClient-3.2.9b283 etc.. .

I just want to execute one simple command using windows platform-
i.e. ssh -T root@
and want to provide the password through my program .

Presently i m using batch files .Need to know the procedure / hint --how to provide the password .

regards,
manoj
paolo barila
Valued Contributor

Re: how to provide password in case of batch files(ssh protocol)

Sorry, how come you have ssh on windows if you didn't install a ssh client?
share share share
ManojKumar
Advisor

Re: how to provide password in case of batch files(ssh protocol)

Hi Paolo,

Actually i m using OpenSsh . I have pasted the dll' and ssh.exe in the system32 folder of Windows .

Now, i can run the ssh.exe from any directory .

regards,
manoj

paolo barila
Valued Contributor

Re: how to provide password in case of batch files(ssh protocol)

Hi,
I would install a ssh client and configure a publickey authentication:

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=999102
share share share
ManojKumar
Advisor

Re: how to provide password in case of batch files(ssh protocol)

Hi,

It' nice to see yr quick replies .

I need a mechanism to provide the password .
Public key authentication is basically for password-less-login (as per my knowledge).

I am using windows platform and i want to execute a single ssh command, also i want to provide the password through my program .

That' all from my side---


regards,
manoj