Error when trying to connect to a SFTP server with a private key and without password

Hi,

I’m trying to use the UiPath.FTP.Activities package to connect to a SFTP server using a private RSA key. When doing so I get an error :

“String reference not set to an instance of a String, parameter name s”

I get this error because I left the password field empty. If I put an empty string instead I get a Permission denied (password) error because it’s trying to log using the password.

I think the activity is always trying to connect using the password. Even when I don’t want to because i’m using a private key.

Any tips about what I can do ?

Regards.

Did you try “string.empty”?

Thank you for your suggestion. Unfortunately the result is the same, I got : Permission denied (password) again.

What version of activity are you using?

I use the 1.0.7346.28183 version, but the same problem was present when I was using the 1.0.6479.13206 version.

Have you tried different packages regarding FTP?

I didn’t find any another package offering the ability to do SFTP.

Hello everyone, did someone managed to find a solution to this issue? @Pouzee, did you find a way ?

No luck here. I used Filezilla instead.
But this pull request added PrivateKeyAuthenticationMethod to SftpSession by IlyaKochetov · Pull Request #53 · UiPath/Community.Activities · GitHub makes me think the problem is fixed/gonna be fixed.
I’ll test it when I can.

I think the fix code is already integrated, so please go ahead and give it a try. If not, please contact me, I will help you out

Hi @Ilya_Kochetov i tested it again but i get this password error again.image I checked the thread from @Pouzee and i see that is still in development. I’m open to any ideas for this. Please let me know what do you think. Thanks
Below i added a print screen of the Properties
image

@CristianDan, I see that my code is already merged into the main branch, so please confirm that you downloaded the latest updates and rebuild the nuget

I can confirm that is the latest one available and i also rebuilt the build but no luck.

I think what happend is that while the new code is available the new version was not compiled by and pushed to nuget feed.
Your best way to get an updated version is to use this project GitHub - UiPath/Community.Activities: Repository of Windows Workflow Foundation Activities for UiPath Community and compile it yourself in Visual Studio (it’s free from Microsoft and there are good guides on UiPath documentation about how to do that).
If you are unable to do so you will have to wait for someone to do this for you

1 Like

@CristianDan, I’ve compiled the latest version of FTP activity and checked that it works. Please note that it’s exactly the same code as in the official repository, so I suggest you only use it until the official feed will be updated with the latest version

UiPath.FTP.Activities.2.1.2.nupkg (44.6 KB)

1 Like

Hi Ilya, i will test right now. Thank you very much for the help!

Hi guys, did you solved this issue? I’ve tried with the unofficial package indicated by @Ilya_Kochetov but still no luck. The new error message is “Invalid private key file”.
FileZilla and Putty are working fine with the same private key file.
Thanks

@Mugur you need to convert your key into OpenSSH key. PPK keys used by putty start with
PuTTY-User-Key-File-2: ssh-rsa
you need to have a key starting with
-----BEGIN OPENSSH PRIVATE KEY----- EDIT: THIS IS INCORRECT
-----BEGIN RSA PRIVATE KEY-----

You could do that in PuttyGen
image

Hi @Ilya_Kochetov
I’ve converted the Putty ppk in OpenSSH key as indicated. Now it’s starts with
-----BEGIN OPENSSH PRIVATE KEY-----
Then I’ve tried to open the ftp connection but the below error was raised
image

Should I do something else? I have to change something on the public key too?
Thanks

My bad, I completely forgot that it’s not OpenSSH, it’s RSA. The key should start with
-----BEGIN RSA PRIVATE KEY-----
Open your command line and type
ssh-keygen -p -m PEM -f <name of your openssh key>
it will be converted

1 Like