Wrtie to ssh’s stdin from another process

I have ssh connection where I want to perform some actions with pauses, but there is no ability to write a script for this system. My idea was to write to /proc/<pid>/fd/0 but unfortunately this doesn’t work (letters appear in ssh terminal, but don’t change anything).

Is there any way to perform such actions?

Answer

Can you do something like cat input.txt | ssh target.yourdomain.com " ./process"?

petr@d1:~$ echo "hello" | ssh myuser@myserver "cat"
hello

Attribution
Source : Link , Question Author : P. Dmitry , Answer Author : Petr Chloupek

Leave a Comment