Supondo que seu servidor remoto tenha um shell compatível com POSIX, o seguinte deve funcionar:
ssh ...options... 'command & pid=$!; sleep 20; kill $pid'
De fato, o padrão POSIX informa sobre $!
:
Expands to the decimal process ID of the most recent background command (see Lists) executed from the current shell. (For example, background commands executed from subshells do not affect the value of "$!" in the current shell environment.) For a pipeline, the process ID is that of the last command in the pipeline.
Se o sistema remoto tiver controle de trabalho, você poderá reduzi-lo desta maneira:
ssh ...options... 'command & sleep 20; kill %1'