Linux上VNC 啟動和關閉 已經常見問題__Linux

來源:互聯網
上載者:User

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 ~]#

   

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.