Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-60698

sshCommand with sudo: true waits forever

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • ssh-steps-plugin
    • None
    • Jenkins 2.204.1
      Ubuntu 16.04.5 LTS

      I have an issue using an sshCommand with sudo set to true from within a pipeline.

      withCredentials([sshUserPrivateKey(credentialsId: credentials_id, keyFileVariable: 'JenkinsIdentity')]) {
      	script {
      		def remote = [name: server_name, host: host_name, knownHosts: remote_knownHosts, user: remote_user, timeoutSec: 1200, identityFile: JenkinsIdentity]
      		
      		// install application
      		sshCommand remote: remote, command: '/home/user/install.sh', sudo: true
      	}
      }
      

      The command executes on the remote server, but it's waiting forever. Probably waiting for user input.

      On the remote server i see this in processes:
      root 62610 62609 0 16:35 ? 00:00:00 sudo -S -p 4b0b21d6-23ab-4e47-b21e-8362bdf2c4d0 sh /home/user/install.sh

      It will only stop when i abort the jenkins job.

      Any ideas on what i can try?

            nrayapati Naresh Rayapati
            nickhardy Nick Hardy
            Votes:
            3 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated: