Answer the question
In order to leave comments, you need to log in
ProxyCommand in SSH
Good evening. Stuck on ProxyCommand SSH option. I can't figure out exactly how it works.
So, as an argument to this option, we specify a specific command. Please explain where exactly this command is called, on the client or on the server. What is being fed to it on stdin, and where is its stdout directed to. In general, as detailed as possible.
Answer the question
In order to leave comments, you need to log in
ssh receives the data received by the "out of port" command (comes from the command's stdout). In turn, ssh writes commands to stdin
So, I decided to check what was going on with the pipes there (it's hard to say "pipes").
We start ssh, without specifying the ProxyCommand option:
ssh [email protected]
lsof | grep -E "^ssh.*FIFO"
pv /dev/zero | ssh [email protected] "cat > /dev/null"
lsof | grep -E "^ssh.*FIFO"
ssh 23782 svon 0r FIFO 0.8 0t0 2401849 pipe ssh 23782 svon 4r FIFO 0.8 0t0 2401849 pipe
lsof | grep -E "^ssh.*TCP"
ssh 24344 svon 3u IPv4 2432025 0t0 TCP arch:59472->super-vps.hell:ssh (EST.)
ssh -o "ProxyCommand nc %h %p" [email protected]
lsof | grep -E "(^ssh|^nc).*FIFO"
ssh 24899 svon 4w FIFO 0.8 0t0 2449781 pipe ssh 24899 svon 5r FIFO 0.8 0t0 2449782 pipe nc 24900 svon 0r FIFO 0.8 0t0 2449781 pipe nc 24900 svon 1w FIFO 0.8 0t0 2449782 pipe
lsof | grep -E "(^ssh|^nc).*IPv4"
nc 24900 svon 3u IPv4 2449789 0t0 TCP arch:59476->super-vps.hell:ssh (EST.)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question