My setup is like this:
[local machine] --> [university network] --> [local machine in university network]
[machine1] --> [machine2] --> [machine3]
I have setup passwordless access with ssh-keygen. When I'm on machine1, I can type ssh user2@machine2 and I am promptly connected. I can move on from there to type ssh user3@machine3 and I'm in.
I now want to be able to type ssh machine3 on machine1 and directly connect the the third machine. I wrote the following .ssh/config file:
Host machine3
Hostname machine3
ProxyCommand ssh user2@machine2 -W %h:%p
User user3
IdentityFile ~/.ssh/id_rsa.pub
IdentitiesOnly yes
However, now I am always prompted for the password for user3. If I type it in, I'm connected, so the tunneling works. How can I skip typing in the password for user3?
Machine1 is Windows10 Pro (I'm using the ssh command in the power-shell). Machine2 runs Ubuntu 20.04.2 LTS (Focal Fossa) Machine3 runs Linux Mint 20.3 Una