Skip to content

Instantly share code, notes, and snippets.

@hartzell
Created November 10, 2016 16:15
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save hartzell/4a1923ec51350ffd2a3de4e5118fc2e3 to your computer and use it in GitHub Desktop.
Save hartzell/4a1923ec51350ffd2a3de4e5118fc2e3 to your computer and use it in GitHub Desktop.
A groovy script to disable the built-in sshd server in Jenkins
// Drop this into init.groovy.d so that it gets executed at startup time.
// One could also use this script to explicitly set a port.
def inst = Jenkins.getInstance()
def sshDesc = inst.getDescriptor("org.jenkinsci.main.modules.sshd.SSHD")
sshDesc.setPort(-1)
sshDesc.getActualPort()
sshDesc.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment