sshtunnel icon indicating copy to clipboard operation
sshtunnel copied to clipboard

Key passphrase is not used properly

Open GGurtner opened this issue 6 years ago • 3 comments

Hi there, I am unable to use the open_tunnel function with a key and no ssh agent. Tested on linux mint 17.2 and 18.3, with sshtunnel version 0.1.3 and 0.1.4.

To reproduce, create ssh private/public keys with a passphrase. Then this for instance:

ssh_tunnel = open_tunnel('ssh_hostname',
                        ssh_username='user',
                        ssh_pkey='path/to/private/key',
                        ssh_private_key_password='secret',
                        allow_agent=False,
                        remote_bind_address=('127.0.0.1', 3306),
                        )

returns an error: "ValueError: No password or public key available!"`

If I add the key to the ssh agent, then change allow_agent to True, the connection works.

I will try to investigate more the issue when I have a moment.

GGurtner avatar Jun 22 '18 14:06 GGurtner

If you remove ssh_username it should work.

armicron avatar Jul 08 '18 09:07 armicron

I'm getting this same issue with key created using ssh-keygen on Arch linux. Removing the ssh_username doesn't help ...

justinmoon avatar Oct 13 '19 03:10 justinmoon

I had this error.

It turns out I was passing in an invalid key. It wasn't -----BEGIN OPENSSH PRIVATE KEY-----....

mdavis-xyz avatar Mar 27 '20 03:03 mdavis-xyz