Remote Desktop

使用vnc做為remote desktop連線軟體。更多可參考官網文件

修改連線解析度

修改/etc/sysconfig/vncserver檔案。以下面範例而言,使用者root可透過5900+1的port連線,其解析度為800×600。

# vim /etc/sysconfig/vncserver
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600"
如果今天Jeff想用1024×768,可以這樣設定:
# vim /etc/sysconfig/vncserver
VNCSERVERS="1:root 2:jeff"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x768"

為新使用者設定vnc

參考官網文件的2.4. Create xstartup scripts內容。在新增完使用者之後,必須登入那個使用者,並且輸入vncpasswd設定vnc密碼。接著啟動與停止vncserver service以產生config。最後是修改.vnc下的xstartup,如果沒修改連過去會是一個非常醜的連線畫面。這裡可以直接copy現成的xstartup即可。

在CentOS6/RHEL6中必須要安裝tigervnc-server package。使用vncpasswd建立使用者密碼,最後和CentOS5/RHEL5一樣修改/etc/sysconfig/vncserver。
以新增一個user vnc desktop做為範例:

新增使用者

# useradd tonylin
# passwd tonylin
Changing password for user tonylin.
New password:
 
Retype new password:
 
passwd: all authentication tokens updated successfully.

設定VNC

# ssh tonylin@localhost
# vncpasswd
Password:
Verify:
# logout
# service vncserver stop
# vim /etc/sysconfig/vncserver
VNCSERVERS="1:root 2:tonylin"
VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERARGS[2]="-geometry 1024x768"
# service vncserver start

其它

如果在start/stop vncserver service有問題的時候,可以用vncserver -kill指令做處理,砍掉沒正常停止的vncserver process。

# vncserver -list
 
TigerVNC server sessions:
 
X DISPLAY #     PROCESS ID
:1              1637
# vncserver -kill :1

設定VNC

安裝系統時,就可以選擇Enable Remote Administration。如果安裝後要去enable呢? 可以透過ssh連進去執行yast2,沒ssh就…
如下圖選擇Network Services > Remote Administration,

然後打勾Allow Remote Administration,最後請確認有在Firewall中打開VNC使用port(請勿學我去關閉firewall):

也可以透過GUI使用yast去設定,選單路徑與透過ssh執行yast2大同小異。
(連線請用ip:590x)

使用XRDP套件,讓我可以透過Windows遠端桌面連線,擁有比較好的解析度。

Reference