On Thu, Nov 09, 2023 at 12:46:23PM +0000, Mark Rogers wrote:
On Thu, 9 Nov 2023 at 12:31, Jonathan McDowell noodles@earth.li wrote:
Use an SSH agent on your local machine, login to A forwarding the agent (ssh -A HostA) then use scp on A to pull the file from B? Your key never leaves your desktop, but can be used on A while you're connected.
That sounds like what I need but I'm afraid I don't know enough to work through the steps.
I'm either connecting from the (open)ssh commandline on my Linux box or via PuTTY on a Windows box - I have at least used an SSH agent on the latter (pageant) but I don't know how it fits in here, and I don't recall ever using an agent on my Linux (Ubuntu) box.
Try "ssh-add -l" - if you have a running SSH agent it should return without error, if you don't it'll say something like "Error connecting to agent". GNOME has one running by default.
Assuming it's running, do:
ssh-add -c <path to your privatekeyfile>
And then:
ssh HostA
A dialog should pop up asking you to confirm the use of the key, then you'll log into HostA. If you don't do the "-c" bit to ssh-add then you aren't asked to confirm usage. I prefer it when I'm forwarding connections.
"ssh -A <host>" will forward the agent so that your connection on <host> can then use the agent. An "ssh hostB" from host A should then pop up the confirmation dialog again, and log you in.
Will this method of transferring files send them from A -> B, or is it A -> My PC -> B (from a network PoV)? A and B have very good connectivity between them, my PC is over a poor(ish) VDSL link.
The files will go between A + B, only the initial authentication bit comes back to your local PC.
J.