sudo: no tty present and no askpass program specified

Hi Gurus:

Can you help me get out of this message ?

I already commented out the ff line in /etc/sudoers file but still prompts me for this message.

#Defaults requiretty

-sh-3.2$ ./check_diskErrors itag3.pm.staging.intra /dev/sda
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified
sudo: no tty present and no askpass program specified

I'm using FC 11 for the client and FC8 for the source connecting to client.

Any idea on this ?

sudo will only run a program as a different user if one of these 3 conditions has been met (as far as passwords are concerned):

  1. the NOPASSWD option is specified
  2. the user entered the correct target password
  3. the user entered the correct source password

Since options 2 and 3 require a TTY (sudo won't read from a pipe) it won't run if it can't find one. Check your script if at any point you're running a script remotely using ssh, as it's possible that it won't allocate a TTY for a non-interactive remote command.

hi pludi,

Yes, im running ssh remotely on my script and I specify the NOPASSWD command

nagios ALL=NOPASSWD: /usr/sbin/smartctl

I can login automatically to my destination server using nagios. The problem is it won't allocate a TTY for a non-interactive remote command.

 ssh -t