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. C# 获取文件夹下的所有文件的文件名

    String path = @"X:\xxx\xxx"; //第一种方法 var files = Directory.GetFiles(path, "*.txt" ...

  2. html 禁用点击事件

    1.css禁用鼠标点击事件 .disabled { pointer-events: none; } 注:(这个没有试过) jquery禁用a标签方法1 $(document).ready(functi ...

  3. 树莓派挂载ntfs优盘

    步骤一:解压安装NTFS-3G,使用如下命令.    sudo apt-get install ntfs-3g 步骤二:配置挂载NTFS格式的移动硬盘 1. 首先得到NTFS分区的信息  sudo f ...

  4. 使用php用IE打开指定网页

    $cmd = '"C:\Program Files\Internet Explorer\iexplore.exe" http://www.baidu.com'; exec($cmd ...

  5. 常用Linq示例代码

    class Program { static void Main(string[] args) {   //1. Aggregate int[] testArr = new int[] { 1, 2, ...

  6. python 数据类型-字符串-对象和方法

    python的字符串有众多方法,可以在doc文档中查看 示例 转换开头字母为大写 c1="welcome to my python" >>> c1.capital ...

  7. oracle创建HR示例数据库脚本hr_main.sql分享

    需求描述: 今天一同事想要在测试库上进行SQL练习,帮忙安装下这个示例数据库,在此记录下. 操作过程: 1.上传hr_main.sql脚本(10g 11g都可用) 脚本下载链接: https://pa ...

  8. mysql 日志操作

    https://www.cnblogs.com/dreamworlds/p/5478293.html http://www.jb51.net/article/76886.htm

  9. [scala] scala 对象(六)

    1.单例对象和伴生对象 2.定义单利对象的apply方法可不通过构造器直接创建对象 3.extends 来扩展单例对象 4.枚举实现 /** * 单例对象 * * @author xuejz * @d ...

  10. 虚拟机安装linux系统无法上网的解决方法

    原文:https://www.jb51.net/article/118267.htm 周末闲来无事,用虚拟机安装了centos6.5系统,安装成功后发现不能连接网络,然后我就一脸蒙蔽了,无奈之下,只能 ...