sshtunnel icon indicating copy to clipboard operation
sshtunnel copied to clipboard

ERROR | Password is required for key /home/me/.ssh/id_rsa

Open dale-wahl opened this issue 2 years ago • 4 comments

I have seen similar problems resulting in ValueErrors, but I am having a problem with my rsa key and unsure how to get sshtunnel to accept my password.

server = SSHTunnelForwarder('server', ssh_pkey='~/.ssh/id_rsa', ssh_private_key_password='mypassword', remote_bind_address=('127.0.0.1',3306))
2022-02-23 10:00:05,394| ERROR   | Password is required for key /home/me/.ssh/id_rsa

The password is correct and key file exists. I have checked and the key uses the -----BEGIN RSA PRIVATE KEY----- designation at the start. I also ensured my ssh-agent was started and the key was added per this StackOverflow thread. I have also tried with allow_agent=False per the docs.

I am on Windows 10 and have tried both natively and using the Linux subsystem.

Any idea what could be causing the ERROR | Password is required for key /home/me/.ssh/id_rsa?

dale-wahl avatar Feb 23 '22 10:02 dale-wahl

i have same issue

akrasnov-marfatech avatar Mar 15 '22 15:03 akrasnov-marfatech

+1

sebgiles avatar May 05 '22 08:05 sebgiles

Any idea what could be causing the ERROR | Password is required for key /home/me/.ssh/id_rsa?

@dale-wahl - I think I determined why the issue is happening. Paramiko only supports a few ciphers for the private key. If you don't have one of these key types here (as manually checked here in this repo) then it won't be able to use the private key.

Short of this paramiko issue getting attention I don't think sshtunnel is going to build out support for this. One idea is to use openssh commandline to decrypt your private key before handing off to sshtunnel but that obviously comes with additional security problems so do at your own risk.

nsepetys avatar May 09 '22 19:05 nsepetys

I see this log message, but it does not prevent my tunnel from working. I had a very old id_dsa file in my ~/.ssh which I was not using.

Renaming this file to DISABLE_id_dsa makes the ERROR log message stop happening, tunnel still works.

johnww2-nwxg avatar Sep 23 '22 14:09 johnww2-nwxg