I'm trying to figure out why msfconsole is exiting when started from with a detached screen, but not when started from a non detached screen.

Here are the steps:

screen -d -m -S msf
screen -S msf -p 0 -X stuff "msfconsole\n"
screen -R -S msf

msfconsole exits right after loading where:

screen -S msf
msfconsole  <-from within screen

allows it to actually run without exiting after loading. How do I fix this?


I've found a solution that helped me .

A simple approach is to: ssh in to your metasploit box, run screen -dRR, and in the resulting shell run msfconsole. Then, in the future, if you disconnect your ssh client and reconnect, just run screen -dRR again and you'll be connected back w/your screen session running msfconsole. The screen -dRR command also creates a screen session if one does not exist, which is why it works even when there is no existing screen session.

just open an other ssh session or terminal then run screen -d or just screen -d if running a single screen.


  • Perhaps I’m misunderstanding, but it seems to me that this is at best a workaround.  If this is an actual solution, please explain how it answers the question. … … … … … … … … … … … … … … … … Do not respond in comments; edit your answer to make it clearer and more complete. – G-Man Nov 30 '17 at 13:39
  • Yes that's a work around... I need it to start in detached mode and run that command. – Zack Dec 1 '17 at 14:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.