Centos上VNC 启动和关闭 常见问题汇总
2016-07-25 15:16
946 查看
1. 重设密码
[root@yqrh5u2 ~]# vncpasswd
Password:
Verify:
[root@yqrh5u2 ~]#
2. 启动和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
3. 重新启动一个手动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 ~]#
[root@yqrh5u2 ~]# vncpasswd
Password:
Verify:
[root@yqrh5u2 ~]#
2. 启动和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
3. 重新启动一个手动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 ~]#
相关文章推荐
- Ubuntu linux 查看串口连接信息
- linux命令_查_ls
- Linux安装程序Anaconda分析
- windows remote login linux encounter black screen
- Dubbo线程模型(结合Linux线程数限制配置的实战经验分享)
- Linux运维学习历程-第一天-基础知识
- Linux的哲学
- linux脚本攻略 sort,uniq,cut 命令详解
- 无人值守自动化安装linux系统
- 初学linux虚拟机.centos7(一)桌面和命令行模式互相切换
- 扩大VMware虚拟机中linux硬盘空间
- 通过samba共享目录的方式搭建lamp平台并安装wordpress(二)
- linux学习随笔第二天
- CentOS 7 NFS服务器和客户端设置
- Linux基础系列(1)
- Linux安装python的.tar.gz包
- linux中inode理解
- linux 常用文件管理命令
- 您的Cookie没有开启,不能登陆成功 的解决
- Linux_Linux命令_zip/unzip_压缩/解压缩 详解