Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to execute a script in Linux platform "" (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 "" 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 ./'"/>
        <redirector inputstring="sudopassword"/>        

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

If you type "sorry, you must have a tty to run sudo" in a search engine, you obtain the following instructions on first link (

" 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


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.