2012年10月7日星期日

[RPi] X11 Forwarding Over SSH2

拿到Raspberry Pi除了從console登入後開啟X Window也可透過SSH將X遠端傳送過來

environment:
* PC : Ubuntu 10.04
* RPi: 2012-09-18-wheezy-raspbian.img

1.將Ubuntu的X Server權限打開
可以透過command的方式將allowed_users修改為anybody
$ sudo vim /etc/X11/Xwrapper.config
或是dpkg,選擇Anybody即可
$ sudo dpkg-reconfigure x11-common
Because the X server runs with superuser privileges, it may be unwise to permit any user to start it, for security  reasons.  On the other hand, it is even more unwise to run general-purpose X client programs as root, which is what may happen if only root is permitted to start the X server.  A good compromise is to permit the X server to be started only by users logged in to one of the virtual consoles.
Users allowed to start the X server:  
           Root Only    
       Console Users Only      
            Anybody     

2.在Ubuntu下指令,就可以X11 Forwarding Over SSH2了
$ xinit -e ssh -XY user@pi lxsession -- :1

順便紀錄一下幾個指令與文章:
查看目前所使用的window manager(Debian/Ubuntu系列需安裝wmctrl)
$ wmctrl -m
Name: Openbox
Class: 
PID: N/A
Window manager's "showing the desktop" mode: OFF
查看目前所使用的Desktop Environment
$ echo $XDG_CURRENT_DESKTOP
LXDE

這篇講到的tty和:N的確容易搞混,裡面是這樣說的
You may be confusing virtual console numbers, ttyN, with X display numbers, :N. ttyN, where N is typically 1..12, is the console that you see after you press Ctrl+Alt+FN, and tty0 is a special device referring to the current console. :N, where N is typically 0..9, refers to the Nth different X server on the host, usually counting from zero.
這篇對整個X,SSH,Window Managers和Desktop Environments有詳細的說明,並解釋了各種X over SSH的方式與比較其優缺點

reference:
* X Over SSH2 - A Tutorial
* [Howto] Redirect X over SSH to other PC
* 理解 Xwindow

沒有留言: