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

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: