开发者

VB.NET connect to Linux server

I have to develop a small application that will connect to a Linux server (scp on port 22), upload a file, and then execute the file. The 开发者_JAVA百科first thing that came to mind was to call WinSCP from my app, but the initial connection will always prompt to accept the hostkey. When calling WinSCP from the commandline you can press a key to copy the hostkey to the clipboard, and then you can use it with the -hostkey switch to connect. Any thoughts on how I might do this in VB? It would have to look like this:

  1. Attempt to connect via WinSCP
  2. Copy hostkey to clipboard when prompted
  3. Attempt to connect again using hostkey

I'm just not sure about #2. I would have to send a keystroke for the letter 'C' which causes the hostkey to be copied to the clipboard. Of course if there is a better way to do what I'm trying to do, please let me know.


Using Rebex, a 3rd party assembly that does everything I need.


If you are using WINSCP clinet UI, when you first connect copy the hostkey and put the value in a config file.

In your vb.net app set the sessionOptions.SshHostKey equal to that value.

If the hostkey doesn't change then this will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜