Spawning Shells

Methods for invoking a shell.

bash

/bin/bash -i

sh

/bin/sh -i

echo

echo 'os.system('/bin/bash')'

perl

perl -e 'exec "/bin/sh";'

python

$ python -c 'import pty;pty.spawn("/bin/sh")'

vi

$ :!bash

Upgrade from shell to bash

SHELL=/bin/bash script -q /dev/null

Fully Interactive TTY

  • Background the current remote shell (^Z), update the local terminal line settings with stty2 and bring the remote shell back.

stty raw -echo && fg

Last updated