linux下vnc设置

本文详细介绍了如何配置和使用VNC服务器,包括启动、停止、重启VNC,设置密码,客户端登陆,以及设置登陆到特定桌面的操作。此外,还解决了一个在Linux下设置xhost遇到的错误,并提供了相应的解决方法。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、VNC的启动/停止/重启
#service vncserver start/stop/restart
关闭具体的vncserver命令:vncserver -kill :1       vncserver -kill :2
2、设置密码
#vncpasswd
3、客户端登陆
在vnc客户端中输入:服务器端IP:1或服务器端IP:2
4、设置登陆到KDE桌面
a.
[root@ics-pc ~]# cat /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
# .

VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 800x600 -alwaysshared -depth 24"



b.
[root@ics-pc ~]# vi /root/.vnc/xstartup 
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
set starting GNOME desktop startkde &


重启VNC即可。

vnc安装 oracle:
出现错误提示:“Xlib: connection to ":1.0" refused by server”
如下处理:
实用技巧:在Linux下设置xhost方法步骤
source:
http://www.knowsky.com/397544.html
第一步:用root登陆
linux
,启动vnc服务;

第二步:根据vnc起来的端口,设置export DISPLAY=localhost:1(1表示vnc在第一个tty上启动的),vnc的启动信息见附件1;

第三步:执行xhost +,并且提示“
access
control disabled, clients can connect from any host”才正确。
linux下的操作日志如下:


[root@localhost ~]# vncserver
New 'localhost:1 (root)' desktop is localhost:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/localhost:1.log
[root@localhost ~]# export DISPLAY=localhost:1 
[root@localhost ~]# xhost +
access control disabled, clients can connect from any host

在设置xhost时,出现了unable的问题。

使用上诉方法就可以搞定。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值