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

前端 未结 26 1680
失恋的感觉
失恋的感觉 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 03:58

    Command sudo fails as it is trying to prompt on root password and there is no pseudo-tty allocated (as it's part of the script).

    You need to either log-in as root to run this command or set-up the following rules in your /etc/sudoers (or: sudo visudo):

    # Members of the admin group may gain root privileges.
    %admin  ALL=(ALL) NOPASSWD:ALL
    

    Then make sure that your user belongs to admin group (or wheel).

    Ideally (safer) it would be to limit root privileges only to specific commands which can be specified as %admin ALL=(ALL) NOPASSWD:/path/to/program

提交回复
热议问题