2016-06-02 28 views
7

Trascorso diversi giorni configurando l'archvio /etc/sudoers per poter concedere le autorizzazioni per l'utente root jenkins. Ho installato Jenkins sul mio server perché ospito diversi progetti con symfony, ionic, neo4j, ecc ... Il problema è che non riesco a creare nei progetti con ionic, ottengo questo errore: sudo: no tty present and no askpass program specified. Questo è il contenuto del mio/etc/sudoers file:Jenkins sudo: nessun presente tty e nessun programma askpass specificato con NOPASSWD

# 
# This file MUST be edited with the 'visudo' command as root. 
# 
# Please consider adding local content in /etc/sudoers.d/ instead of 
# directly modifying this file. 
# 
# See the man page for details on how to write a sudoers file. 
# 
Defaults env_reset 
Defaults mail_badpass 
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 

# Host alias specification 

# User alias specification 

# Cmnd alias specification 

# User privilege specification 
root ALL=(ALL:ALL) ALL 
jenkins ALL=(ALL) NOPASSWD: ALL 
# Allow members of group sudo to execute any command 
%sudo ALL=(ALL:ALL) ALL 
+1

Vedere http://stackoverflow.com/a/24648413/54506 (si parla di una riga dovrebbe essere l'ultima in sudoers ..) – Jayan

+1

Possibile duplicato di [Come risolvere 'sudo: no tty presente e nessun programma askpass specificato' errore?] (Http://stackoverflow.com/questions/21659637/how-to-fix-sudo-no-tty-present-and-no-askpass-program-specified-error) – Jayan

+0

Ricordare che queste impostazioni di 'sudoers' devono essere impostate su un nodo specifico dove avviene la generazione , che non ha bisogno di essere un 'master'. – luka5z

risposta

13

Ho testato la soluzione descritta da @Jayan nei commenti della domanda. È necessario includere la nuova riga alla fine del file:

Soluzione: https://stackoverflow.com/a/24648413/54506

# 
# This file MUST be edited with the 'visudo' command as root. 
# 
# Please consider adding local content in /etc/sudoers.d/ instead of 
# directly modifying this file. 
# 
# See the man page for details on how to write a sudoers file. 
# 
Defaults env_reset 
Defaults mail_badpass 
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" 

# Host alias specification 

# User alias specification 

# Cmnd alias specification 

# User privilege specification 
root ALL=(ALL:ALL) ALL 

# Allow members of group sudo to execute any command 
%sudo ALL=(ALL:ALL) ALL 
jenkins ALL=(ALL) NOPASSWD: ALL 
0

Questo è abbastanza possibile che si aggiunge un utente errato al file sudoers. Questo è successo anche a me e la soluzione per aggiungere una voce nel file sudoers non funzionava per me. Avrai bisogno di sapere l'utente che il jenkins sta usando per eseguire i comandi. A questo scopo è possibile aggiungere un passaggio di generazione (Esegui shell) all'interno del vostro Jenkins con il seguente comando:

whoami 

eseguite di nuovo il lavoro Jenkins e in uscita della console, si vedrà l'utente che Jenkins è usando per eseguire comandi. Dovrai quindi aggiungere questo utente al tuo file sudoers. Per esempio, se l'utente è stato 'gatto', si aggiungerà la seguente riga alla fine del file sudoers:

tomcat ALL=(ALL) NOPASSWD: ALL 

Rif: http://techrofile.com/jenkins-sudo-no-tty-present-and-no-askpass-program-specified-with-nopasswd/

Problemi correlati