TigerVNC的安装
只进行了下文的2、3、4和6步,vnc的关闭可以参考其第6步结尾。
参考文章进行安装:https://blog.csdn.net/fjmsonic/article/details/104366421?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_utm_term~default-0-104366421-blog-107471665.235v38pc_relevant_anti_vip&spm=1001.2101.3001.4242.1&utm_relevant_index=3
TigerVNC的使用
1.1 设置vnc密码
(base) ljh@taurus:~$ vncpasswd
Password:
Verify:
Would you like to enter a view-only password (y/n)? n
1.2 服务器端设置
(base) ljh@taurus:~$ vncserver
/usr/bin/xauth: file /home/liujunhui2/.Xauthority does not exist
New 'taurus:1 (liujunhui2)' desktop at :1 on machine taurus
Starting applications specified in /etc/X11/Xvnc-session
Log file is /home/liujunhui2/.vnc/taurus:1.log
Use xtigervncviewer -SecurityTypes VncAuth -passwd /home/liujunhui2/.vnc/passwd :1 to connect to the VNC server.
note: “1"这个数字就下面的"N”,注意替换数字
1.3 本地端设置
另开终端,命令行连接服务器:
ssh -L 590N:localhost:590N ljh@111.111.111.111
1.4 本地vnc viewer设置
1.5 本地命令行(1.3)记得杀死vnc
vncserver -kill :N
1.6查看目前的vncserver数量
vncserver -list
1.7开启VNC端口
vncserver #开启的端口号默认排序
vncserver :1 #开启指定的端口号,中间+空格
1.8 修改VNC密码
vncpasswd
Password:
Verify:
1.9 关闭vnc进程
方法一:
vncserver -list #查看vnc的端口号
TigerVNC server sessions:
X DISPLAY # PROCESS ID
:1 8881
vncserver -kill :1 #kill相关端口号
方法二:
ps -ef |grep vnc
kill -9 进程号
Notes
我在服务的的一直使用的账户里登录vnc,桌面一直无法显示,黑屏且有黑叉,命令行窗口除terminal外均位于左上角无法移动。实际该问题在vnc登录日志中(~/.vnc/*.log)中已经记录了很多报错,但实际很难解决,而同服务器其他用户并没有出现上述问题,解决办法为重建新用户,从零开始,问题解决(嘿嘿)。