centos 7 VNC Viewer: Timed out waiting for a response from the host computer

刚开始使用centos 7 在使用vnc viewer时超时。配置centos7的vnc-server后解决

In CentOS 7.0 there is change in the vncserver configuration file. Before ContOS 7.0 it was  /etc/sysconfig/vncservers and now it have changed in /lib/systemd/system/vncserver@.service. Next I will use the original file and create the configuration file as shown:

cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:1.service


Now we will edit the file as follows:

vi /etc/systemd/system/vncserver@:1.service

Replace the string <USER> with appropriate vncuser’s username.  In my case I will be using the user srijanjust created above:

[...]
[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
#ExecStart=/sbin/runuser -l <USER> -c "/usr/bin/vncserver %i"
#PIDFile=/home/<USER>/.vnc/%H%i.pid
ExecStart=/sbin/runuser -l srijan -c "/usr/bin/vncserver %i"
PIDFile=/home/srijan/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

If you wish to add more users you would create a new vncserver@:#.service file and change the <USER>string to the new users.

Firewall settings:

firewall-cmd --permanent --zone=public --add-service vnc-server
firewall-cmd --reload

Now switch to the vncuser just created above and start the vnc service as:

su - srijan
vncserver

[srijan@server1 ~]$ vncserver

You will require a password to access your desktops.

Password:<--yourvncpassword
Verify:<--yourvncpassword
xauth:  file /home/srijan/.Xauthority does not exist

New 'server1.example.com:1 (srijan)' desktop is server1.example.com:1

Creating default startup script /home/kishore/.vnc/xstartup
Starting applications specified in /home/kishore/.vnc/xstartup
Log file is /home/srijan/.vnc/server1.example.com:1.log

[srijan@server1 ~]$

Now make the service enabled on after every reboot with root credentials:

su -
systemctl daemon-reload

systemctl enable vncserver@:1.service

reboot
systemctl start vncserver@:1.service

转自:https://www.howtoforge.com/vnc-server-installation-on-centos-7

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值