Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to execute a script in Linux platform "runme.sh" (which can be executed as sudo user) using another ant script "build.xml". Now i have execute this build.xml from teamcity.

I have code for everything but got struck into while invoking "runme.sh" using sudo in build.xml from team city.

In build.xml i have code like

    <exec dir="${installdir}" executable="/bin/sh">
        <arg line="-c 'sudo ./runme.sh'"/>
        <redirector inputstring="sudopassword"/>        
    </exec>

In team city I get error as " [exec] sudo: sorry, you must have a tty to run sudo".

Can someone please help me resolve this error?

thanks in advance

share|improve this question
    
Post your sudoers file or at least the general options and fragments that should be permitting this commnad to run. Do you have the requiretty option set? –  Zoredache Jul 30 '12 at 22:15

1 Answer 1

If you type "sorry, you must have a tty to run sudo" in a search engine, you obtain the following instructions on first link (http://www.zimbra.com/forums/installation/10553-solved-sudo-sorry-you-must-have-tty-run-sudo.html):

" vi /etc/sudoers

comment out: #Default requiretty "

BR Eric

share|improve this answer
    
Thanks for your comment. –  coolgokul Jul 31 '12 at 16:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.