sudo: no tty present and no askpass program specified

i am trying overide the below error

sudo: sorry, you must have a tty to run sudo

i am aware of ssh -t option. But just experimenting with OS :smiley:

So, tried commenting out

 Defaults requiretty

from my sudoers file after which i am getting the below error

sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: no tty present and no askpass program specified
Sorry, try again.
sudo: 3 incorrect password attempts

can some explain me please which parameter in sudoers file causes this and how to fix this ?

Don't comment the line.

Put in a negate character so it looks like so;

Defaults       !requiretty

tried negating it .. now again this error

sudo: no tty present and no askpass program specified
Sorry, try again.

It's trying to ask for a password and can't, since you have no terminal. The way to fix that is to remove the password requirement for that sudo entry, not remove the TTY requirement.

Be very very specific about it, though. Only allow a specific user to do specific things passwordless.

1 Like

Thanks Corona.. i get it :slight_smile: