I'm writing a script that will ssh into a raspberry pi, and then from the raspberry pi, will ssh into another system to verify that it can connect.
From the windows terminal, I can do this just fine. I can log into my pi with ssh pi@raspberry
, and then while logged in, I can run ssh [SYSNAME]
(I have a config set for this system in my ~/.ssh/config file on my pi) and log into the other system.
I'm using paramiko with python 3.9.7, and I can log into the pi just fine, but then when I try to ssh into the [SYSNAME], it gives me [USER]@[IP]: Permission denied (publickey)
. I did have to add a special ssh key to access this other system on the pi using ssh-add ~/.ssh/other_key
, but I'm not experienced enough to know if this key isn't being used whiled using paramiko.
Thanks in advance!
EDIT:
I found my issue. While I did add the special_key, it was not being used for some reason. Once I manually added the key using ssh -i ~/.ssh/special_key [USER]@[IP] -p 22
, it worked. Now my issue is getting that working without manually specifying the key, but I'm sure I can figure that out. Thanks all!