修改VNC分辨率大小


【VNC】修改VNC分辨率大小

 
VNC的分辨率過小有可能導致圖形化界面操作過程中遇到“確認鍵或取消鍵”無法點擊,分辨率過高又可能導致低分辨率客戶端顯示器無法顯示。
本文給出兩種調整VNC分辨率的方法,供參考。

1.第一種方法:使用geometry參數進行調整
使用man命令獲得關於geometry參數的描述
[root@secdb ~]# man vncserver
……
       -geometry widthxheight
              Specify the size of the desktop to be created. Default is 1024x768.
……


可見,默認的分辨率是1024x768,我們可以使用這個參數對分辨率進行調整。
例如,我們需要將分辨率調整到800x600
[root@secdb ~]# vncserver -geometry 800x600

New 'secdb:5 (root)' desktop is secdb:5

Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/secdb:5.log

此時使用“192.168.23.102:5”登錄VNC便會得到一個800x600的操作窗口。
其他分辨率調整請自行嘗試。

2.第二種方法:修改配置文件vncservers
[root@secdb ~]# vi /etc/sysconfig/vncservers
# The VNCSERVERS variable is a list of display:user pairs.
#
# Uncomment the line below to start a VNC server on display :1
# as my 'myusername' (adjust this to your own).  You will also
# need to set a VNC password; run 'man vncpasswd' to see how
# to do that.
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, see
# <URL:http://www.uk.research.att.com/vnc/sshvnc.html>.

# VNCSERVERS="1:myusername"
# VNCSERVERARGS[1]="-geometry 800x600"
VNCSERVERS="1:root 2:oracle"
VNCSERVERARGS[1]="-geometry 1024x768"
VNCSERVERARGS[2]="-geometry 1024x768"

例如我們可以將最后一行內容調整為如下
VNCSERVERARGS[2]="-geometry 800x600"

重啟vncserver后,使用“192.168.23.102:2”登錄VNC便會得到一個800x600的操作窗口,用戶是oracle。
[root@secdb ~]# /etc/init.d/vncserver restart
Shutting down VNC server: 1:root 2:oracle              [  OK  ]
Starting VNC server: 1:root 2:oracle                   [  OK  ]

3.小結
兩種修改方法各有利弊,請根據具體環境進行調整。使用第一種方法操作簡單,影響范圍小,因為該方法是通過單獨啟動vnc進程來提供服務的,但是容易在系統中遺留過多的vnc進程;第二種方法是通過調整VNC默認分辨率的手段實現的,實現集中管理,但存在因分辨率調整過高導致客戶端無法使用的問題。






免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM