1. 程式人生 > >Centos 7.4 VNC 安裝指令碼

Centos 7.4 VNC 安裝指令碼

#/bin/bash
yum -y install tigervnc-server
firewall-cmd --permanent --add-service=vnc-server
firewall-cmd --reload

rm -rf /etc/systemd/system/[email protected]:1.service
cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:1.service
sudo sed -i "s#ExecStart=/usr/sbin/runuser -l <USER>#ExecStart=/usr/sbin/runuser -l root#g" /etc/systemd/system/

[email protected]:1.service
sudo sed -i "s#PIDFile=/home/<USER>#PIDFile=/root#g" /etc/systemd/system/[email protected]:1.service

systemctl daemon-reload
systemctl restart [email protected]:1.service
echo 'Hao123' | vncpasswd -f > /root/.vnc/passwd

rm -rf /etc/systemd/system/[email protected]

:2.service
cp /lib/systemd/system/[email protected] /etc/systemd/system/[email protected]:2.service
sudo sed -i "s#ExecStart=/usr/sbin/runuser -l <USER>#ExecStart=/usr/sbin/runuser -l merit#g" /etc/systemd/system/[email protected]:2.service
sudo sed -i "s#PIDFile=/home/<USER>#PIDFile=/home/merit#g" /etc/systemd/system/
[email protected]
:2.service

systemctl daemon-reload
systemctl restart [email protected]:2.service
echo 'Hao123' | vncpasswd -f > /home/merit/.vnc/passwd