x11vnc通过SSH隧道 – sudo:没有tty存在,没有指定askpass程序

我试图设置一个一次性的SSH隧道,在login的显示器上实例化x11vnc。

ssh -f -t -L 5900:localhost:5900 [email protected] 'sudo /usr/bin/x11vnc -safer -once -nopw -display :0 -auth /home/user/.Xauthority' 

的/ etc / sudoers中:

 user@myhost:~$ sudo cat /etc/sudoers [sudo] password for user: # # This file MUST be edited with the 'visudo' command as root. # # Please consider adding local content in /etc/sudoers.d/ # instead of directly modifying this file. # Defaults:user !requiretty Defaults env_reset Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" root ALL=(ALL:ALL) ALL user ALL=(ALL:ALL) NOPASSWD: /usr/bin/x11vnc %admin ALL=(ALL) ALL %sudo ALL=(ALL:ALL) ALL 

最终的结果是这样的:

 Pseudo-terminal will not be allocated because stdin is not a terminal. bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 5900 Could not request local forwarding. ebz@icarus:~ $ sudo: no tty present and no askpass program specified Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: no tty present and no askpass program specified Sorry, try again. sudo: 3 incorrect password attempts 

它确实说bind: Address already in use ,但我觉得这是不正确的和不相关的:

 Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 10.1.10.1:domain *:* LISTEN - tcp 0 0 *:ssh *:* LISTEN - tcp6 0 0 xxxx::xxxx:xxxx::domain [::]:* LISTEN - tcp6 0 0 [::]:ssh [::]:* LISTEN - 

可以肯定的是,我们可以忽略这个信息。 而且,删除用户的sudo条目也没有效果。

多谢你们。 干杯。

PS这里的解决scheme – 通过SSH运行命令时没有TTY存在 – 没有工作:(

此外,一个侧面说明,这是服务器相关(关于OPENNEBULA定制LXC VMM实施的背景)。 请不要将此标记为脱离主题,因为这是有效的应用程序用例。

UPDATE

Plus -tt ,minus -f -t开关:

 $ ssh -tt -L 5900:localhost:5900 [email protected] 'sudo /usr/bin/x11vnc -safer -once -nopw -display :0 -auth /home/user/.Xauthority' bind: Address already in use channel_setup_fwd_listener: cannot listen to port: 5900 Could not request local forwarding. [sudo] password for user: 

但它提示input密码? 它虽然我input密码后工作。

确保user不在adminsudo组中,或者在组行之后放置user的sudoers行。

从sudoers手册页

当多个条目匹配用户时,它们按顺序应用。 如果有多个匹配,则使用最后的匹配(不一定是最具体的匹配)。