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

Not able to execute sudo command on "Send files or execute commands over SSH"

      Started by user Kumar
      Building on master in workspace /xxx/xxxxxx/xxx/xxxxxxxx
      Copied 1 artifact from "xxxxxxxx" build number xxx
      SSH: Connecting from host [xxxxxxxxxxxx]
      SSH: Connecting with configuration [xxxxxxxxx] ...
      SSH: EXEC: STDOUT/STDERR from command [sudo service tomcat7 stop] ...
      sudo: no tty present and no askpass program specified
      SSH: EXEC: completed after 200 ms
      SSH: Disconnecting configuration [xxxxxxxxx] ...
      ERROR: Exception when publishing, exception message [Exec exit status not zero. Status [1]]
      Build step 'Send files or execute commands over SSH' changed build result to UNSTABLE
      Sending e-mails to: xxxxxxxxxxxxxxxxxx
      Started calculate disk usage of build
      Finished Calculation of disk usage of build in 0 seconds
      Started calculate disk usage of workspace
      Finished Calculation of disk usage of workspace in 0 seconds
      Finished: UNSTABLE

          [JENKINS-34884] Not able to execute sudo command on "Send files or execute commands over SSH"

          Oleg Nenashev added a comment -

          Fixed the component

          Oleg Nenashev added a comment - Fixed the component

          Kumar J added a comment -

          I am able to run this command "sudo service tomcat7 stop" from "Putty" and its working there.But it id giving error while running from jenkins.

          Even I can see this in "chkconfig --list" from "Putty"
          tomcat7 0:off 1:off 2:on 3:on 4:on 5:on 6:off

          Please give me solution for this

          Kumar J added a comment - I am able to run this command "sudo service tomcat7 stop" from "Putty" and its working there.But it id giving error while running from jenkins. Even I can see this in "chkconfig --list" from "Putty" tomcat7 0:off 1:off 2:on 3:on 4:on 5:on 6:off Please give me solution for this

          Oleg Nenashev added a comment -

          It's not a Jenkins issue. Your jenkins user on the slave/master just does not have appropriate permissions.
          Further reading: http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error . There are also other many other pages with the solution in Google.

          Oleg Nenashev added a comment - It's not a Jenkins issue. Your jenkins user on the slave/master just does not have appropriate permissions. Further reading: http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error . There are also other many other pages with the solution in Google.

          bap added a comment -

          The answer is in this line of output:
          sudo: no tty present and no askpass program specified

          Check the "Exec in pty" Advanced option for the transfer set

          https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin#PublishOverSSHPlugin-Execinpty

          bap added a comment - The answer is in this line of output: sudo: no tty present and no askpass program specified Check the "Exec in pty" Advanced option for the transfer set https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over+SSH+Plugin#PublishOverSSHPlugin-Execinpty

          Kumar J added a comment -

          my issue was resolved..thanks for your help

          Kumar J added a comment - my issue was resolved..thanks for your help

          Oleg Nenashev added a comment -

          you're welcome

          Oleg Nenashev added a comment - you're welcome

          For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues

          Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/139
          And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-34884%22

          (Note: this is an automated bulk comment)

          Gavin McDonald added a comment - For your information, all publish-over-ssh component type JENKINS issues related to the Publish Over SSH plugin have been transferred to Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues Here is the direct link to this issue in Github: https://github.com/jenkinsci/publish-over-ssh-plugin/issues/139 And here is the link to a search for related issues: https://github.com/jenkinsci/publish-over-ssh-plugin/issues?q=%22JENKINS-34884%22 (Note: this is an automated bulk comment)

            oleg_nenashev Oleg Nenashev
            manojktumati Kumar J
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: