Start SSH connection in PuTTY, run a command, and leave the session active

*爱你&永不变心* 提交于 2019-12-01 05:50:09

The SSH session closes (and PuTTY with it) as soon as the command finishes. By default the "command" is a shell. As you have overridden this default "command" and yet you want to run the shell nevertheless, you have to explicitly execute the shell yourself:

my-command ; /bin/bash

See also Executing a specific command on the server.

One option to go is set up your putty remote command like this:

ls > dir.ls & /bin/bash

In this example command you want to run is "ls > dir.ls" what creates file dir.ls with content of directory listing.

And as you want to leave shell open you can add aditional command "/bin/bash" or any other shell of your choice.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!