Starting Putty from Excel

erlingre

New Member
Joined
Jan 20, 2016
Messages
3
Hi,

I have a Excel spreadsheet with hostnames in column A.
I have added this macro so that I can doubleclick to launch Putty to log on a given host:

Code:
[FONT=Calibri][SIZE=2]Private Sub Worksheet_BeforeDoubleClick(<wbr>ByVal Target As Range, Cancel As Boolean)
     If Range("A" & ActiveCell.Row) <> Empty Then
         Shell "C:\Program Files (x86)\putty\putty.exe -agent <myuser>@" & ActiveCell, vbNormalFocus
     End If
 End Sub
</myuser>[/SIZE][/FONT]

It works, but I have not been able to user pageant to avoid typing my password (I want to use key based auth).
Pageant works well if I start putty outside of Excel.
I have also tried to start pageant with a macro from Excel with no sucess.

Do you have any idea how I can fix this? I suspect it may be something with environment variables, etc if there is such a thing in Windows.

Thanks,

Erling
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
I'm well aware of how I can log on in Putty without using a password. It works well (using ssh-keys and pageant) when I launch putty outside Excel, but when I start
Putty via a macro in Excel it does not work. So I wonder if programs started via a macro lives in a isolated environment or something (thus not being able to use the alredy started ssh-agent).
 
Upvote 0
I have found the error. Nothing was wrong with my macro or Execel, the error was simply that I passed the wrong option to Putty.
Instead of using -agent I had to use -A to make Putty use Pageant for authentication.

Sorry for bothering you with a non Excel related error, and thanks for your replies and patience.
 
Upvote 0

Forum statistics

Threads
1,216,099
Messages
6,128,822
Members
449,469
Latest member
Kingwi11y

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top