sudo no tty present and no askpass program specified
DebianThis forum is for the discussion of Debian Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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?
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.