ssh with command…Plus the shell

前端 未结 5 2217
别跟我提以往
别跟我提以往 2020-12-14 10:08

I\'d like a command that ssh\'es into a machine, runs a command (cd or execute a script or su), and then gives me the shell. Passing a command to ssh seems to always exit.

5条回答
  •  我在风中等你
    2020-12-14 10:37

    Variation on the other answers really, use the -t option of ssh to force pseudo-tty allocation:

    ssh -t me@machine ./executeMyScript '&&' bash -i
    

提交回复
热议问题