Modify jenkins sshd server to run interactive bash shell

Step 1: Modify jenkins sshd server

This will additionally run a bash shell
Turn on jenkins sshd server and set port.

// Activate sshd server
// "Manage Jenkins"
//    ->
//    "Configure Global Security"
// then copy/paste this into script console

import jenkins.model.*;

def inst = Jenkins.getInstance()
def sshDesc = inst.getDescriptor(

println 'Done with step 1!'

Step 2: get sh shell

ssh -p <jenkins-sshd-port> <jenkins-fqdn>

Step 3: get python shell

python -i

Step 4: spawn pty bash shell

>>> import pty
>>> pty.spawn("/bin/bash")

NOTE: bash shell has a weird double echo effect