我嘗試通過ssh建立管道鏈。讓管道鏈通過ssh打開
mkfifo localpipe;
和遠程機器mkfifo remotepipe;
cat localpipe | ssh -q einstein "cat > remotepipe"
使用echo "input;" > localpipe
我可以發送輸入到一個程序,從remotepipe讀取。但在此之後,remotepipe,localpipe和ssh-connection將被關閉。 有沒有辦法保持localpipe和ssh打開,但關閉remotepipe,我需要爲了使遠程端的程序處理其輸入?
如果這不適用於cat或其他unix命令,我可以在C中編寫一個簡短的貓替代品來實現這個目的嗎?
localpipe也可能會關閉,但我想保持SSH速度的原因打開。
這似乎工作!有沒有辦法將ControlMaster作爲隧道?另外:我可以將這些選項添加到我的.ssh/config中,以便所有與給定主機的ssh連接以這種方式建立連接? – highsciguy
兩個問題都可以。 – huitseeker