sudo: no tty present and no askpass program specified

This error message will occur if sudo is not able to ask for the password (no tty is present) (like for instance when trying to sudo rsync).

One solution to this is to add the line “Defaults visiblepw” to the /etc/sudoers file.

[Todd C. Miller Todd.Miller at said on sudo-users: 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 above]

12 thoughts on “sudo: no tty present and no askpass program specified

  1. My name is Piter Jankovich. oOnly want to tell, that your blog is really cool
    And want to ask you: is this blog your hobby?
    P.S. Sorry for my bad english

  2. @Piter: Yes this is a hobby “blog” (more of a notepad where I write down things I need to remember/don’t wish to search for again)

  3. Thanks for this information.
    In my situation, when the script prompt for a password word, i want it to read it from a file. How can i do it?

    Thanks in advance

  4. i’m trying to use -A option in sudo..
    I want o make that askpass program as gksu.
    i’ve set the evironment variable SUDO_ASKPASS to /usr/bin/gksu
    but still no change when i tried using sudo -s -A
    any help or suggestions..??

  5. I have not used gksu but the two things I can suggest you try are
    to just run gksu first (thus making sure that works) and then try
    sudo -s -A /usr/bin/gksu (and if that works you know the problem is with the variable)

  6. Pingback: :: b l a c k o n s o l e :: » :: sudo: no tty present

  7. el error sudo no tty present and no askpass program specified me da cundo desde JAVA quiero vr los datos de la placa base con dmedecode no se si hay alguna instruccion para hacerlo desde java. gracias

  8. @Raul. I think either you are misunderstaing the error, or I am misunderstanding you. You should not need to do this in java, but on the machine where you are trying to use the sudo command.

Comments are closed.