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

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

    Maybe the question is unclear that why no answer was matching it but I had the same error message when I was trying to mount sshfs which required sudo : the command is something like this :

    sshfs -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server" user@my.server.tld:/var/www /mnt/sshfs/www
    

    by adding the option -o debug

    sshfs -o debug -o sftp_server="/usr/bin/sudo /usr/lib/openssh/sftp-server" user@my.server.tld:/var/www /mnt/sshfs/www
    

    I had the same message of this question :

    sudo: no tty present and no askpass program specified
    

    So by reading others answer I became to make a file in /etc/sudoer.d/user on my.server.tld with :

    user ALL=NOPASSWD: /usr/lib/openssh/sftp-server
    

    and now I able to mount the drive without giving too much extra right to my user.

提交回复
热议问题