How to fix 'sudo: no tty present and no askpass program specified' error?

前端 未结 26 1602
失恋的感觉
失恋的感觉 2020-11-22 03:36

I am trying to compile some sources using a makefile. In the makefile there is a bunch of commands that need to be ran as sudo.

When I compile the sour

26条回答
  •  囚心锁ツ
    2020-11-22 04:05

    sudo by default will read the password from the attached terminal. Your problem is that there is no terminal attached when it is run from the netbeans console. So you have to use an alternative way to enter the password: that is called the askpass program.

    The askpass program is not a particular program, but any program that can ask for a password. For example in my system x11-ssh-askpass works fine.

    In order to do that you have to specify what program to use, either with the environment variable SUDO_ASKPASS or in the sudo.conf file (see man sudo for details).

    You can force sudo to use the askpass program by using the option -A. By default it will use it only if there is not an attached terminal.

提交回复
热议问题