LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices



Reply
 
Search this Thread
Old 04-28-2011, 05:23 PM   #1
invader44
Member
 
Registered: Dec 2008
Location: America
Distribution: Ubuntu 11.04
Posts: 64

Rep: Reputation: 15
Unhappy 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
 
Old 04-29-2011, 10:05 AM   #2
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
Hello,

Do you have by any chance this in your sudoers file:
Code:
Defaults    requiretty
Kind regards,

Eric
 
Old 04-29-2011, 12:32 PM   #3
invader44
Member
 
Registered: Dec 2008
Location: America
Distribution: Ubuntu 11.04
Posts: 64

Original Poster
Rep: Reputation: 15
Hi Eric,

I don't have that line in my sudoers file.
 
Old 04-29-2011, 12:52 PM   #4
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
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
 
Old 05-02-2011, 04:15 PM   #5
invader44
Member
 
Registered: Dec 2008
Location: America
Distribution: Ubuntu 11.04
Posts: 64

Original Poster
Rep: Reputation: 15
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
 
Old 05-03-2011, 02:09 AM   #6
EricTRA
Guru
 
Registered: May 2009
Location: Gibraltar, Gibraltar
Distribution: Fedora 20 with Awesome WM
Posts: 6,805
Blog Entries: 1

Rep: Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291Reputation: 1291
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
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to replace ssh-askpass with ssh-askpass-gnome? rrije Linux - Software 2 11-10-2010 05:26 AM
Smb4K no tty present sirscott44 Suse/Novell 1 03-12-2010 01:29 AM
Can A User Space Program Create a /dev/tty? Peatmoss Programming 7 08-30-2008 05:02 AM
ssh-askpass in F7 marozsas Fedora 1 06-19-2007 01:39 PM
need an idea on detecting USB pen present in user program captainstorm Programming 4 11-26-2003 08:40 AM


All times are GMT -5. The time now is 07:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration