set environment variable SSH_ASKPASS or askpass in sudoers, resp

后端 未结 6 2167
孤城傲影
孤城傲影 2021-02-07 07:12

I\'m trying to login to a ssh server and to execute something like:

ssh user@domain.com \'sudo echo \"foobar\"\'
         


        
6条回答
  •  忘掉有多难
    2021-02-07 07:59

    Defaults askpass=/usr/bin/ssh-askpass

    ssh-askpass requires X server, so instead of providing a terminal (via -t, as suggested by nosid), you may forward X connection via -X:

    ssh -X user@domain.com 'sudo echo "foobar"'
    

    However, according to current documentation, askpass is set in sudo.conf as Path, not in sudoers.

提交回复
热议问题