Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

6
  • and how do I lose the session after closing execution?
    – e-info128
    Commented Oct 27, 2014 at 18:47
  • 1
    @WHK What do you mean by losing the session? Commented Oct 28, 2014 at 16:16
  • @Llamageddon: I think he's wondering the same thing I am. If I wanted to put my entire SSH session into screen, I might use your answer and put screen there instead of the echo. The problem with that is that finishing the screen session will return to the SSH prompt instead of logging out. Just writing out this comment gave me the answer, though: add the logout command after the screen command.
    – zondo
    Commented Jan 4, 2017 at 13:53
  • This however does not work for ssh session which do not use bash, e.g. when I open an sftp session.
    – Fabio
    Commented Jan 28, 2017 at 10:49
  • @zondo @e-info128 exec command will replace the current shell with whatever you run. Commented Jan 29, 2017 at 12:37