日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux服务器黑屏_xshell连接Linux系统(小红帽7.3)服务器,导致服务器黑屏

發(fā)布時間:2024/9/30 linux 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux服务器黑屏_xshell连接Linux系统(小红帽7.3)服务器,导致服务器黑屏 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

以32313133353236313431303231363533e59b9ee7ad9431333365633863root用戶運行以下命令來安裝vncserver;

yum install tigervnc-server

同樣運行以下命令來安裝vncviewer;

yum install vnc

停止并禁用防火墻;

systemctl stop firewalld.service

systemctl?disable firewalld.service

二.配置

vncviewer基本上不用配置;

vncserver的配置,創(chuàng)建一個新的配置文件,以開啟1號窗口為例(也可以同時開啟多個窗口,修改數(shù)字即可),方法如下:

cp?/lib/systemd/system/vncserver@.service?/lib/systemd/system/vncserver@:1.service

或者再增加一個窗口:

cp?/lib/systemd/system/vncserver@.service?/lib/systemd/system/vncserver@:2.service

編輯/lib/systemd/system/vncserver@:1.service,設(shè)置用戶root相關(guān)參數(shù),最終內(nèi)容如下:

[Unit]Description=Remote?desktop?service?(VNC)After=syslog.target?network.target[Service]Type=forking#?Clean?any?existing?files?in?/tmp/.X11-unix?environmentExecStartPre=/bin/sh?-c?'/usr/bin/vncserver?-kill?%i?>?/dev/null?2>&1?||?:'ExecStart=/sbin/runuser?-l?root?-c?"/usr/bin/vncserver?%i"PIDFile=/root/.vnc/%H%i.pidExecStop=/bin/sh?-c?'/usr/bin/vncserver?-kill?%i?>?/dev/null?2>&1?||?:'

1.設(shè)置為非root用戶報錯:[root@localhost system]# systemctl status -l vncserver@:2.service

vncserver@:2.service - Remote desktop service (VNC)

Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset:

disabled)

Active: failed (Result: exit-code) since 一 2016-04-25 19:07:23 CST; 7s ago

Process: 10305 ExecStart=/usr/sbin/runuser -l fang -c /usr/bin/vncserver %i (code=exited,

status=1/FAILURE)

Process: 10291 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || :

(code=exited, status=0/SUCCESS)

4月 25 19:07:23 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...

4月 25 19:07:23 localhost.localdomain systemd[1]: vncserver@:2.service: control process

exited, code=exited status=1

4月 25 19:07:23 localhost.localdomain systemd[1]: Failed to start Remote desktop service

(VNC).

4月 25 19:07:23 localhost.localdomain systemd[1]: Unit vncserver@:2.service entered failed

state.

4月 25 19:07:23 localhost.localdomain systemd[1]: vncserver@:2.service failed.

2.Type=forking報錯,改為Type=simple

[root@localhost system]# systemctl start vncserver@:2.service

Job for vncserver@:2.service failed because the control process exited with error code. See

"systemctl status vncserver@:2.service" and "journalctl -xe" for details.

[root@localhost system]# systemctl status -l vncserver@:2.service

● vncserver@:2.service - Remote desktop service (VNC)

Loaded: loaded (/etc/systemd/system/vncserver@:2.service; enabled; vendor preset:

disabled)

Active: failed (Result: exit-code) since 一 2016-04-25 19:09:41 CST; 6s ago

Process: 12367 ExecStart=/usr/sbin/runuser -l root -c /usr/bin/vncserver %i (code=exited,

status=98)

Process: 12354 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || :

(code=exited, status=0/SUCCESS)

4月 25 19:09:41 localhost.localdomain systemd[1]: Starting Remote desktop service (VNC)...

4月 25 19:09:41 localhost.localdomain systemd[1]: vncserver@:2.service: control process

exited, code=exited status=98

4月 25 19:09:41 localhost.localdomain systemd[1]: Failed to start Remote desktop service

(VNC).

4月 25 19:09:41 localhost.localdomain systemd[1]: Unit vncserver@:2.service entered failed

state.

4月 25 19:09:41 localhost.localdomain systemd[1]: vncserver@:2.service failed.

3.vnc viewer客戶端連接黑屏

改變xstartup的權(quán)限

這個問題是很多人容易忽視的問題,也是造成連接成功后黑屏的原因之一。

在CentOS中,xstartup的文件路徑為:/root/.vnc/ (可以通過locate xstartup來查看xstartup的文件路徑)

所以需要執(zhí)行:chmod 777 /root/.vnc/xstartup

關(guān)閉防火墻

systemctl stop firewalld.service #停止

systemctl disable firewalld.service #禁用

三.應(yīng)用

更新systemctl以使其生效;

systemctl daemon-reload

設(shè)置vncserver的密碼;

vncpasswd root

按提示輸入密碼以及確認密碼

啟動該服務(wù)用來啟用vnc的1號窗口;

systemctl?start?vncserver@:1.service??或者?vncserver?:1

關(guān)閉1號窗口:

systemctl?stop?vncserver@:1.service???或者?vncserver?-kill?:1

設(shè)置為開機自動啟動;

systemctl?enable?vncserver@:1.service

總結(jié)

以上是生活随笔為你收集整理的linux服务器黑屏_xshell连接Linux系统(小红帽7.3)服务器,导致服务器黑屏的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。