修改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默认分辨率的手段实现的,实现集中管理,但存在因分辨率调整过高导致客户端无法使用的问题。
本文给出两种调整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默认分辨率的手段实现的,实现集中管理,但存在因分辨率调整过高导致客户端无法使用的问题。
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 25岁的心里话
· 闲置电脑爆改个人服务器(超详细) #公网映射 #Vmware虚拟网络编辑器
· 零经验选手,Compose 一天开发一款小游戏!
· 因为Apifox不支持离线,我果断选择了Apipost!
· 通过 API 将Deepseek响应流式内容输出到前端