Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

martin

Re: Unable to fetch files after opening session using private key.

Please attach full session log files for both scenarios (using the latest version of WinSCP).

To generate the session log file, set Session.SessionLogPath. Submit the log with your post as an attachment. Note that passwords and passphrases not stored in the log. You may want to remove other data you consider sensitive though, such as host names, IP addresses, account names or file names (unless they are relevant to the problem). If you do not want to post the log publicly, you can mark the attachment as private.
Tabish

Unable to fetch files after opening session using private key.

Hi,
I have a c# project in which we connect winscp using private key in following manner
SessionOptions sessionOptions = new SessionOptions
{
    Protocol = Protocol.Sftp,
    HostName = hostName,
    UserName = userName,
    SshHostKeyFingerprint = sshHostKeyFingerprint,
};
LogHelper.Log("Placing credentials " + DateTime.Now);
if (isPasswordBased == 0)
    sessionOptions.SshPrivateKeyPath = winscpSSHPrivateKeyPath;
else
    sessionOptions.Password = password;


where "winscpSSHPrivateKeyPath" is basically ppk full path. Also though we are able to connect & even open session, but when we try to check our remote files using following code
session.ListDirectory("\") 

it always gives error of unable to find path.

Hence we tried opening session using username & password using same above code. And it all worked, we were even able to retrieve files & even put files. but it is not possible when we try to open using private key.
Can some one please help us if we are missing something.

regards.