vncserver无法启动

一、问题现象

运行vncserver的时候提示出错,查看vnc的日志发现如下错误日志

litin@linuxService:~/.vnc$ cat linuxService\:4.log 

Xvnc Free Edition 4.1.1 - built Jul 31 2015 19:10:31
Copyright (C) 2002-2005 RealVNC Ltd.
See http://www.realvnc.com for information on VNC.
Underlying X server release 40300000, The XFree86 Project, Inc


Sun Feb 11 16:20:23 2018
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on port 5904
 vncext:      created VNC server for screen 0
error opening security policy file /etc/X11/xserver/SecurityPolicy
Could not init font path element /usr/X11R6/lib/X11/fonts/Type1/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/Speedo/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/misc/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/75dpi/, removing from list!
Could not init font path element /usr/X11R6/lib/X11/fonts/100dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/75dpi/, removing from list!
Could not init font path element /usr/share/fonts/X11/100dpi/, removing from list!
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified
xsetroot:  unable to open display ':4'
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified
vncconfig: unable to open display ":4"
此版本的 gnome-terminal 已不再支持选项 "--login" ;您可能想要创建一个有期望设定的配置文件,然后使用新的“--profile”选项
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified

** (gnome-terminal:3636): WARNING **: Could not open X display
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified
无法处理参数:无法打开显示:
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified

** (gnome-session:3637): WARNING **: Could not open X display
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
No protocol specified

** (gnome-session:3637): WARNING **: 无法打开显示:
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host
AUDIT: Sun Feb 11 16:20:26 2018: 3629 Xvnc4: client 1 rejected from local host

二、问题分析

  问题的根源是在于SecurityPolicy打开不了(“error opening security policy file /etc/X11/xserver/SecurityPolicy“),猜测这个文件的读写权限有问题。

利用命令xauth -b list可以验证

litin@linuxService:~/.vnc$ xauth -b list
xauth:  /home/litin/.Xauthority not writable, changes will be ignored

三、解决方法

用chown 命令把文件”.Xauthority“改成当前用户名就可以成功启动vncserver了

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
为了让Ubuntu VNC Server在开机时自动启动,您需要执行以下步骤: 1.打开终端并输入以下命令以编辑vncserver@.service文件: ```shell sudo nano /etc/systemd/system/vncserver@.service ``` 2.在文件中添加以下内容: ```shell [Unit] Description=Start TightVNC server at startup After=syslog.target network.target [Service] Type=forking User=<USER> Group=<USER> WorkingDirectory=/home/<USER> PIDFile=/home/<USER>/.vnc/%H:%i.pid ExecStartPre=-/usr/bin/vncserver -kill :%i > /dev/null 2>&1 ExecStart=/usr/bin/vncserver -depth 24 -geometry 1280x800 :%i ExecStop=/usr/bin/vncserver -kill :%i [Install] WantedBy=multi-user.target ``` 请注意,您需要将<USER>替换为您的用户名。 3.保存并关闭文件。 4.使用以下命令重新加载systemd管理器配置: ```shell sudo systemctl daemon-reload ``` 5.使用以下命令启用VNC Server服务: ```shell sudo systemctl enable vncserver@1.service ``` 请注意,这里的“1”是您要启用的VNC Server实例的数字。如果您有多个实例,请为每个实例重复此步骤。 6.现在,您可以使用以下命令启动VNC Server服务: ```shell sudo systemctl start vncserver@1.service ``` 请注意,这里的“1”是您要启动VNC Server实例的数字。如果您有多个实例,请为每个实例重复此步骤。 7.使用以下命令检查VNC Server服务的状态: ```shell sudo systemctl status vncserver@1.service ``` 如果一切正常,您应该看到“active (running)”状态。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值