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

前端 未结 26 2129
失恋的感觉
失恋的感觉 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:56

    Granting the user to use that command without prompting for password should resolve the problem. First open a shell console and type:

    sudo visudo
    

    Then edit that file to add to the very end:

    username ALL = NOPASSWD: /fullpath/to/command, /fullpath/to/othercommand
    

    eg

    john ALL = NOPASSWD: /sbin/poweroff, /sbin/start, /sbin/stop
    

    will allow user john to sudo poweroff, start and stop without being prompted for password.

    Look at the bottom of the screen for the keystrokes you need to use in visudo - this is not vi by the way - and exit without saving at the first sign of any problem. Health warning: corrupting this file will have serious consequences, edit with care!

提交回复
热议问题