X11転送の問題 - 認証エラー

X11転送の問題 - 認証エラー

私のホームサーバーでSSHを介したX11転送を設定しようとしています。

サーバーはmoonrakerヘッドレス構成でDebian Jessie(ホスト名)を実行しています。

私のクライアントはOS X 10.10を実行しています。以前は、このクライアントを使用して別のサーバーでX11転送を使用したことがあるため、問題は私のMacにあるようではありません。

このタスクを実行した後に表示される正確なエラーメッセージxclockは次のとおりです。

X11 connection rejected because of wrong authentication.
Error: Can't open display: localhost:10.0

インターネット検索後、次のことを確認しました。

1)$ ls -lA ~/.Xauthority

-rw------- 1 ssunder ssunder 55 Sep 21 21:53 /home/ssunder/.Xauthority

2)$ grep X11 /etc/ssh/sshd_config

X11Forwarding yes
X11DisplayOffset 10
X11UseLocalhost yes

3)私の顧客は~/.ssh/config次のとおりです。

ForwardX11 yes
ForwardX11Trusted yes

4)$ xauth list

moonraker/unix:10  MIT-MAGIC-COOKIE-1  d7e2e4a8c5aa4430bfcc2abb436940d2

5)sshdデバッグレベル2で実行:# cat /var/log/auth.log | grep sshd | tail -n 100 | less

Sep 21 22:19:57 moonraker sshd[20089]: debug1: X11 connection requested.
Sep 21 22:19:57 moonraker sshd[20089]: debug2: fd 10 setting TCP_NODELAY
Sep 21 22:19:57 moonraker sshd[20089]: debug2: fd 10 setting O_NONBLOCK
Sep 21 22:19:57 moonraker sshd[20089]: debug1: channel 3: new [X11 connection from ::1 port 34632]
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: open confirm rwindow 2097152 rmax 16384
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: rcvd eof
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: output open -> drain
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: obuf empty
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: close_write
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: output drain -> closed
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: rcvd close
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: close_read
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: input open -> closed
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: send close
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: is dead
Sep 21 22:19:57 moonraker sshd[20089]: debug2: channel 3: garbage collecting
Sep 21 22:19:57 moonraker sshd[20089]: debug1: channel 3: free: X11 connection from ::1 port 34632, nchannels 4

また、何を確認するのか知っていますか?

ベストアンサー1

サーバーのユーザーがカスタム.ssh/rcファイルを持っている場合、または非標準/etc/ssh/sshrcファイルを持っている場合、xauthコンテンツは正しく設定されません。

sshdマニュアルページから:

 If the file ~/.ssh/rc exists, sh(1) runs it after reading the environment
 files but before starting the user's shell or command.  It must not pro‐
 duce any output on stdout; stderr must be used instead.  If X11 forward‐
 ing is in use, it will receive the "proto cookie" pair in its standard
 input (and DISPLAY in its environment).  The script must call xauth(1)
 because sshd will not run xauth automatically to add X11 cookies.

カスタムファイルが必要な場合は、rcそのファイルに追加するか、マニュアルページから追加してください。

    if read proto cookie && [ -n "$DISPLAY" ]; then
            if [ `echo $DISPLAY | cut -c1-10` = 'localhost:' ]; then
                    # X11UseLocalhost=yes
                    echo add unix:`echo $DISPLAY |
                        cut -c11-` $proto $cookie
            else
                    # X11UseLocalhost=no
                    echo add $DISPLAY $proto $cookie
            fi | xauth -q -
    fi

おすすめ記事