LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to automatically accept ssh host key

Hi there,

 

Here is how you solve this problem.

 

1) You have to upload the putty.exe file onto that Windows box.

2) Login to the Windows box using the account that will be in the batch script.

3) Run putty.exe and try to ssh to that other Linux/Unix box.

     * You will then see a window pop up to accept the ssh-rsa2 key of the Linux box (this window will only pop up the first time you

          try to ssh to the Linux box); after you click Yes on that window, the ssh-rsa2 key of the Linux box will be stored into the

         Windows registry, under SSHHostKey

     * It is also important that you have to be logged in to that Windows box with the account that you will use in your scheduled

         task of the batch job.

4) Now inside your batch script, you can use pscp, psftp, plink, etc ... with the -pw option to specify the password right on the

     command line, and it will not ask you to accept the rsa-ssh key because it has been stored into the Windows registry already.

   

    Let me know if it works.

 

0 Kudos
Message 11 of 13
(14,200 Views)

When using SSH, upon first connection you are required to verify a service host key in order to make a connection.

 

Through plink, the command line will generate a prompt, asking the user to "accept service host key? (y/n)".

 

Step 1: Fix the "Keyboard Interactive Authentication prompts from server"

Follow the URL instruction and Deselect the "Attempt keyboard Interactive auth (SSH-2) in your putty.

https://support.linuxacademy.com/hc/en-us/articles/360027730172-How-Can-I-Copy-and-Paste-into-Putty-...

 

Step 2: Below is the commands will fix the "verify a service host key" for every Linux server first SSH connection using plink.

 

echo yes| C:\PuTTY\plink.exe user-name@10.148.147.41 -pw *************** date

 

Step 3: Now you can immediately ran your next scripts like "server uptime checks" or "monitoring agent restart" using plink with -batch option (disable all interactive prompts)

 

C:\PuTTY\plink.exe -batch user-name@10.148.147.41 -pw *************** -m C:\uptime_linux.sh

 

C:\PuTTY\plink.exe -batch user-name@10.148.147.41 -pw *************** -m C:\monitoring-agent-check_linux.sh

 

Above mentioned information's 100% will help you to automate the Linux tasks using plink utility.

 

 

0 Kudos
Message 12 of 13
(3,897 Views)

When using SSH, upon first connection you are required to verify a service host key in order to make a connection.

 

Through plink, the command line will generate a prompt, asking the user to "accept service host key? (y/n)".

 

Step 1: Fix the "Keyboard Interactive Authentication prompts from server"

Follow the URL instruction and Deselect the "Attempt keyboard Interactive auth (SSH-2) in your putty.

https://support.linuxacademy.com/hc/en-us/articles/360027730172-How-Can-I-Copy-and-Paste-into-Putty-...

 

Step 2: Below is the commands will fix the "verify a service host key" for every Linux server first SSH connection using plink.

 

echo yes| C:\PuTTY\plink.exe user-name@10.148.147.41 -pw *************** date

 

Step 3: Now you can immediately ran your next scripts like "server uptime checks" or "monitoring agent restart" using plink with -batch option (disable all interactive prompts)

 

C:\PuTTY\plink.exe -batch user-name@10.148.147.41 -pw *************** -m C:\uptime_linux.sh

 

C:\PuTTY\plink.exe -batch user-name@10.148.147.41 -pw *************** -m C:\monitoring-agent-check_linux.sh

 

Above mentioned information's 100% will help you to automate the Linux tasks using plink utility.

 

 

0 Kudos
Message 13 of 13
(3,888 Views)