SSH X11転送 - 特定のアプリケーションでのみ認証の問題

SSH X11転送 - 特定のアプリケーションでのみ認証の問題

私は2つのraspiを持っており、SSHとX11転送を使用して互いに接続しますssh pi@[pi's IP] -X -v。 X11転送を使用してリモートGUIを表示することは、多くのアプリケーションでうまく機能します。ただし、1つのアプリケーションでは機能しません。デモアプリケーションです ADI TOF SDK。 「SSH -X」セッションでこの操作を開始すると、エラーが発生します(一部の初期化ステップを通過した後)。

X11 connection rejected because of wrong authentication.

Gtk-WARNING **: 13:11:31.083: cannot open display: localhost:10.0
pi@aditofpi:~/Desktop $ ./aditof-demo.sh 
I0604 13:11:28.104044 28301 device_enumerator_raspberry.cpp:16] Looking for devices on the target
I0604 13:11:28.105119 28301 device_enumerator_raspberry.cpp:49] Looking at: /dev/video0 for an eligible TOF camera
I0604 13:11:28.106060 28301 system_impl.cpp:31] System initialized
I0604 13:11:28.106182 28301 camera_96tof1.cpp:47] Initializing camera
I0604 13:11:28.106228 28301 local_device.cpp:118] Opening device
I0604 13:11:28.309844 28301 calibration.cpp:230] EEPROM calibration data size 65044 bytes
I0604 13:11:31.062580 28301 camera_96tof1.cpp:64] Camera initialized
I0604 13:11:31.069535 28301 local_device.cpp:213] Starting device
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 52008
debug1: channel 1: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 1: free: x11, nchannels 2
Unable to init server: Could not connect: Connection refused

(aditof-demo 1.2.0:28301): Gtk-WARNING **: 13:11:31.083: cannot open display: localhost:10.0

これは他のアプリケーションに適用されるため、一般的なX11転送の問題ではありません。たとえば、テストにはxclockとgeanyを使用します。これは、aditof-demoアプリケーションに次のものがあるという事実に関連している可能性があります。複数のGUIウィンドウ?ローカルでアプリケーションを起動すると、これが表示されます。 X11転送はこの問題を処理できますか?その他ウィンドウ)?また、-Xの代わりに-Yを使用して信頼できるSSHセッションを開始してみましたが、同じ結果が出ました。両方のシステムの私のssh_configには、次のブロックが含まれています。大丈夫に見えますか?

Host *
#   ForwardAgent no
ForwardX11 yes
ForwardX11Trusted yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   GSSAPIKeyExchange no
#   GSSAPITrustDNS no
#   BatchMode no

X11転送がこの特定のアプリケーションだけでなく他のアプリケーションでも機能する理由をご存知ですか?

アップデート:piユーザーとsudoユーザーでaditofアプリケーションを起動しました。どちらも機能せず、出力も同じです。ところがgeanyでテストしてみると実際に違いがありました。ユーザー pi では動作しますが、sudo では動作しません。 sudoと同様に、geanyもaditifアプリケーションと同じエラーで失敗します。まあ、変です。

pi@aditofpi:~/Desktop $ geany
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 56062
debug1: channel 1: new [x11]
debug1: confirm x11
debug1: channel 1: FORCE input drain
debug1: channel 1: free: x11, nchannels 2
pi@aditofpi:~/Desktop $ sudo geany
debug1: client_input_channel_open: ctype x11 rchan 3 win 65536 max 16384
debug1: client_request_x11: request from ::1 56066
debug1: channel 1: new [x11]
debug1: confirm x11
X11 connection rejected because of wrong authentication.
debug1: channel 1: free: x11, nchannels 2
Unable to init server: Could not connect: Connection refused

Geany: cannot open display

ベストアンサー1

これが本当だと思いました。いいえ上記の特定のアプリケーションに関連する内容ですが、プログラムを実行するとすべてのアプリケーションに現れる一般的な問題ですsudo。私いつもこのエラーは、セッションX11 connection rejected because of wrong authentication.で何かを開始したときに発生します。ユーザーと同じアプリケーションを起動すると、常にうまく機能します。最初にこれを見なかったのは、aeditofアプリケーションが.shファイルに隠されているからです。これはユーザーpiで始まりますが、.shファイル内には次のものがあります。ssh -Xsudopisudo

#!/bin/sh
cd /home/pi/aditof_sdk/build/examples/aditof-demo
sudo ./aditof-demo

次に変更した後:

#!/bin/sh
cd /home/pi/aditof_sdk/build/examples/aditof-demo
./aditof-demo

そしてこれを行う:

pi@raspberrypi:~ $ ssh pi@aditofpi'sID -X
pi@aditofpi'sID's password: 
Linux aditofpi 4.19.86-v7l+ #1 SMP Tue Dec 3 17:21:04 EET 2019 armv7l

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jun  9 15:09:15 2020 from aditofpi'sID
pi@aditofpi:~ $ ~/Desktop/aditof-demo.sh

申請書の編集が始まります! :)中級はい! xclockやgeanyなどの他のアプリケーションと同じ動作です。ユーザーpiとして機能しますが、sudoで始まると機能せずに失敗しますX11 connection rejected because of wrong authentication.。しかし、それは別のトピックです。

おすすめ記事