Remote command execution with single sign-on

Advertisement

vrkorada
Joined:
Posts:
4

Remote command execution with single sign-on

Hi,
I want to connect to unix hoist from my windows7 desktop and execute remote commands. I am able to do using Quest putty/ plink without typing any password using GSSAPI. However, Can I do the same using WinSCP?

Regards,
Venkat

Reply with quote

Advertisement

vrkorada
Joined:
Posts:
4

Re: Remote command execution with single sign-on

Hi,
Sorry for not clear in my question. I am looking for a .net library, so that I can use it in my application.
I couldn't find any option to use the same advanced settings to enable GSSAPI authentication.
Am I missing something? Can you share a code snippet to set the GSSAPI?

Regards,
Venkat

Reply with quote

vrkorada
Joined:
Posts:
4

Re: Remote command execution with single sign-on

Hi,
Thanks for reply. Rawsettings option is working. However, now I am getting error asking to set the hostkey.

Here is the snippet:

try
{
// Setup session options
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Scp,
HostName = "host03.company.com",
UserName = "venkat",
//Password = "mypassword",
//SshHostKeyFingerprint = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"
};
sessionOptions.AddRawSettings("AuthGSSAPI","1");
sessionOptions.AddRawSettings("SshProt", "2");
using (Session session = new Session())
{
// Connect
session.Open(sessionOptions);
}
return 0;
}
catch (Exception e)
{
Console.WriteLine("Error: {0}", e);
return 1;
}

When I use the GUI tool WinSCP, it never asks me the host key and I never provided hostkey to plink also.
Am I missing something here?

Regards,
Venkat

Reply with quote

Advertisement

vrkorada
Joined:
Posts:
4

Re: Remote command execution with single sign-on

Hi,
With WinSCP UI / plink, when we connect to a host for hte first time, we get a prompt saying server's host key is not in cache and asking the confirmation to continue with caching hte key.

Is there any API for checking the availability of the key in the cache and if it not available, any API to get eh server's host key?

Regards,
Venkat

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
41,441
Location:
Prague, Czechia

Re: Remote command execution with single sign-on

vrkorada wrote:

Is there any API for checking the availability of the key in the cache
No.

and if it not available, any API to get eh server's host key?
You should not automate this. It would spoil security purpose of the verification.
Anyway, if you do not care about security, you can accept any host key with SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey:
https://winscp.net/eng/docs/library_sessionoptions

Reply with quote

Advertisement

You can post new topics in this forum