jenkins fails while restarting my sql “sudo: no tty present and no askpass program specified Sorry, try again.”

前端 未结 3 554
庸人自扰
庸人自扰 2021-02-06 13:12

I just configured jenkins and in the pre-build steps i am trying to restart jenkins but i end up with the following error

Commencing build of Revision c5b9f8daac         


        
相关标签:
3条回答
  • 2021-02-06 13:35

    By adding the following: Defaults:username !authenticate to your /etc/sudoers you should not get the error but this username will be accessible without asking for a password

    0 讨论(0)
  • 2021-02-06 13:45

    Please use the "id" command and paste the output. Only if you are in admin group then you don't need password but for all other even though you have access but you need to type the sudo password. In this case sudo doesn't have a tty to ask for the password and hence the error.

    One solution could be, don't use sudo only for mysql restart, instead run the entire script as sudo "sudo {your script path}" in this case sudo will have the terminal to ask for the password.

    0 讨论(0)
  • 2021-02-06 13:51

    The "no tty present" error indicates that you have the 'requiretty' setting in your sudoers file. In your case, it is probably in /etc/sudoers.d. Once this line is there, it does not matter what group you are in - sudo will require a tty whenever it is executed.

    To get around this, you need to either remove (or comment out) the requiretty line in the configuration file, or add a line to exclude your user from the requiretty setting. You can see how to do that here: Disable requiretty per user

    0 讨论(0)
提交回复
热议问题