0, 重设密码

[root@yqrh5u2 ~]# vncpasswd
          Password:
          Verify:
        [root@yqrh5u2 ~]#

1,启动和kill  vncserver

[root@yqrh5u2 ~]# vncserver :1
  New 'yqrh5u2:1 (root)' desktop is yqrh5u2:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:1.log
[root@yqrh5u2 ~]# vncserver :2
New 'yqrh5u2:2 (root)' desktop is yqrh5u2:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:2.log
[root@yqrh5u2 ~]# ps -ef|grep -i vnc
root    
12572     1  0 02:23 pts/2    00:00:00 Xvnc :1 -desktop yqrh5u2:1
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5901 -pn
root     12580     1  0 02:23 pts/2    00:00:00 vncconfig -iconic
root    
12617     1  0 02:23 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12625     1  0 02:23 pts/2    00:00:00 vncconfig -iconic
root     12735 12536  0 02:24 pts/2    00:00:00 grep -i vnc

手动kill :1, :1的pid是12572,并验证:1确实已经被kill

[root@yqrh5u2 ~]# kill -9 12572
[root@yqrh5u2 ~]# ps -ef|grep -i vnc
root    
12617     1  0 02:23 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12625     1  0 02:23 pts/2    00:00:00 vncconfig -iconic
root     12779 12536  0 02:25 pts/2    00:00:00 grep -i vnc

通过vncserver kill :1,:2,这是最好的方法,推荐使用

[root@yqrh5u2 ~]# vncserver -kill :1
Killing Xvnc process ID 12572
kill 12572: No such process
[root@yqrh5u2 ~]# vncserver -kill :2
Killing Xvnc process ID 12617
[root@yqrh5u2 ~]# ls /root/.vnc/
passwd  xstartup  yqrh5u2:1.log  yqrh5u2:2.log

2,重新启动一个手动kill的vncserver,

因为是手动自己删除的,所以要再删除一下被lock的文件,才可以重新启动,如图所示

[root@yqrh5u2 ~]# vncserver
Warning: yqrh5u2:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server yqrh5u2:1
New 'yqrh5u2:2 (root)' desktop is yqrh5u2:2
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:2.log
[root@yqrh5u2 ~]# vncserver :1
Warning: yqrh5u2:1 is taken because of /tmp/.X1-lock
Remove this file if there is no X server yqrh5u2:1
A VNC server is already running as :1
[root@yqrh5u2 ~]# rm -f  /tmp/.X1-lock
[root@yqrh5u2 ~]# vncserver :1
Warning: yqrh5u2:1 is taken because of /tmp/.X11-unix/X1
Remove this file if there is no X server yqrh5u2:1
A VNC server is already running as :1
[root@yqrh5u2 ~]# ps -ef|grep -i vnc
root    
12971     1  0 02:32 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12979     1  0 02:32 pts/2    00:00:00 vncconfig -iconic
root     13047 12536  0 02:33 pts/2    00:00:00 grep -i vnc
[root@yqrh5u2 ~]# rm -f /tmp/.X11-unix/X1
[root@yqrh5u2 ~]# vncserver :1
New 'yqrh5u2:1 (root)' desktop is yqrh5u2:1
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/yqrh5u2:1.log
[root@yqrh5u2 ~]# ps -ef|grep -i vnc
root    
12971     1  0 02:32 pts/2    00:00:00 Xvnc :2 -desktop yqrh5u2:2
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5902 -pn
root     12979     1  0 02:32 pts/2    00:00:00 vncconfig -iconic
root    
13071     1  1 02:33 pts/2    00:00:00 Xvnc :1 -desktop yqrh5u2:1
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport
5901 -pn
root     13092     1  0 02:33 pts/2    00:00:00 vncconfig -iconic
root     13123 12536  0 02:34 pts/2    00:00:00 grep -i vnc
[root@yqrh5u2 ~]#

Linux上VNC 启动和关闭常见问题的更多相关文章

  1. Linux上VNC 启动和关闭

    查询vnc的线程: [admin@cn2-uat-esb-01-0001 ~]$ ps -ef|grep vncadmin 19080 21305 0 10:04 pts/2 00:00:00 gre ...

  2. linux上安装启动elasticsearch-5.5.1完整步骤

    linux上安装启动elasticsearch-5.5.1完整步骤 学习了:https://blog.csdn.net/hingcheung/article/details/77144574 http ...

  3. 解决SSH窗口关闭,linux上的应用也关闭

    最近在应用linux上的服务的时候发现一个问题 使用SSH远程连接启动的应用在SSH关闭的时候也死掉了,网上查了一下原因 大致是说SSH在关闭的时候会发送一个终止的指令给应用,然后就停了 简要的解决办 ...

  4. 解决Linux上tomcat启动却无法访问

    linux中tomcat的安装 安装tomcat前首先要安装对应的jdk并配置Java环境 下载tomcat安装包 下载路径:https://tomcat.apache.org/download-80 ...

  5. linux下如何启动和关闭weblogic .

    在你定义的域中可以找到如下命令: /[youHome]/domains/[yourDomain]/startWebLogic.sh /[youHome]/domains/[yourDomain]/st ...

  6. Linux上jmeter-server启动失败

    Jmeter-server启动失败:Cannot start. Unable to get local host IP address. is a loopback address 在Windows下 ...

  7. Linux上VNC常见命令

    参考链接: http://blog.csdn.net/russle/article/details/4757888 http://www.linuxidc.com/Linux/2016-06/1320 ...

  8. linux中如何启动和关闭svn

    1,启动SVN sudo svnserve -d -r /home/data/svn/ 其中 -d 表示守护进程, -r 表示在后台执行 /home/data/svn/  为svn的安装目录 2,关闭 ...

  9. 160524、Linux下如何启动、关闭Oracle以及打开关闭监听

    1. linux下启动oraclesu - oraclesqlplus /nologconn /as sysdbastartupexitlsnrctl startexit2. linux下关闭orac ...

随机推荐

  1. Vue 404页面处理

    问题原因: 刷新页面时访问的资源在服务端找不到,因为vue-router设置的路径不是真实存在的路径 解决方案: 第一步:后端配置 Apache <IfModule mod_rewrite.c& ...

  2. iOS 模拟器的“调试-位置”总是变成无的问题

    选择项目的“Edit Scheme...” 并且选择“Options”选项卡,更改你喜欢的默认地理位置 你也可以编辑一个gpx文件永久保存坐标,或者在线生成(传送门). 转自:iOS Simulato ...

  3. [转]java线程安全、jstack\线程dump、内存查看分析总结

    http://jameswxx.iteye.com/blog/808546 java线程安全总结二 http://jameswxx.iteye.com/blog/1041173 jstack和线程du ...

  4. sublime text--你所不知道的12个秘密

    转自:http://blog.csdn.net/laokdidiao/article/details/51429404 package control安装: 第一种方法是在控制台中复制粘贴代码按回车, ...

  5. Vim终极指南:所思即所得

    https://blog.csdn.net/dc_726/article/details/78981756

  6. java stream Api

    Stream的简单使用 Stream的使用分为两种类型: Intermediate,一个Stream可以调用0到多个Intermediate类型操作,每次调用会对Stream做一定的处理,返回一个新的 ...

  7. c++const关键字---15

    原创博文,转载请标明出处--周学伟 http://www.cnblogs.com/zxouxuewei/ const是一个C++语言的限定符,它限定一个变量不允许被改变.使用const在一定程度上可以 ...

  8. SQLServer2008/2005 生成数据字典语句

    SELECT 表名 then d.name else '' end, 表说明 then isnull(f.value,'') else '' end, 字段序号=a.colorder, 字段名=a.n ...

  9. SQLServer------备份与还原

    转载: http://www.cnblogs.com/zgqys1980/archive/2012/07/04/2576382.html

  10. ssh面试题总结

    SSH面试题总结: 题目1:Hibernate工作原理及为什么要用? 原理: hibernate,通过对jdbc进行封装,对 java类和 关系数据库进行mapping,实现了对关系数据库的面向对象方 ...