LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (https://www.linuxquestions.org/questions/debian-26/)
-   -   sudo no tty present and no askpass program specified (https://www.linuxquestions.org/questions/debian-26/sudo-no-tty-present-and-no-askpass-program-specified-877695/)

invader44 04-28-2011 04:23 PM

sudo no tty present and no askpass program specified
 
Hi,

I am running an Ubuntu Server 10.10. I have installed Apache2, I put my perl script in /var/lib/cgi-bin. When I run this perl script from the terminal it works fine. When go to a web browser it doesn't. When I look at Apache's error log, I see this line :
"sudo no tty present and no askpass program specified"
I tried editing the sudoers file, with the user www-data ALL=(ALL) NOPASSWD:/path_to_my_script. But nothing changed. What am I doing wrong?

Thanks,
vader

EricTRA 04-29-2011 09:05 AM

Hello,

Do you have by any chance this in your sudoers file:
Code:

Defaults    requiretty
Kind regards,

Eric

invader44 04-29-2011 11:32 AM

Hi Eric,

I don't have that line in my sudoers file.

EricTRA 04-29-2011 11:52 AM

Hi,

Maybe this will shed some light:
Quote:

Recent versions of sudo will refuse to prompt for a password if no
tty is present, since it is not possible to turn off echo in this
case. You can restore the old behavior with a line like:

Defaults visiblepw

in sudoers. However, since you have X windows available you could
use a graphical prompter instead. Sudo doesn't come with its own
but it is possible to use the ssh one. To do this, either set
the SUDO_ASKPASS environment variable or the "askpass" setting
in sudoers to something like /usr/libexec/openssh/ssh-askpass.
--from [sudo-users]

Kind regards,

Eric

invader44 05-02-2011 03:15 PM

Hi Eric,

Would this be the proper way? Make a group called wheel, add the user www-data to that group. Edit the sudoers file and add this line:
%wheel ALL=(ALL) NOPASSWD:/path_to_my_script

I see that ubuntu doesn't have the wheel group anymore.

Thanks

EricTRA 05-03-2011 01:09 AM

Hello,

The syntax is correct so it will allow your user to execute that script without password but I don't think it will make any difference since you added that line for the user www-data before without success. You're trying to execute the command from a webbrowser right? I think that there lies your problem. www-data is a special user. Have you tried to use su to that user and run a sudo command from the terminal to see where it fails? I also found this on the internet for you. Since I don't know Perl I had to look around a bit but I believe it's related to your problem. And since you use Ubuntu another interesting thread related to your issue is this one on the Ubuntu forums. Hope it helps.

Kind regards,

Eric


All times are GMT -5. The time now is 02:38 PM.