# 下面举例进行设置: 首先一样复制一个server配置。改名为vncserver@:2.service cp /lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver@:2.service # 然后进行修改 vim /etc/systemd/system/vncserver@\:2.service -------------------------------------------------------------------------------------------------------- [Unit] Description=Remote desktop service (VNC) After=syslog.target network.target
[Service] Type=forking User=root
# Clean any existing files in /tmp/.X11-unix environment ExecStartPre=-/usr/bin/vncserver -kill %i ExecStart=/usr/bin/vncserver %i PIDFile=/home/test/.vnc/%H%i.pid ExecStop=-/usr/bin/vncserver -kill %i
[Install] WantedBy=multi-user.target
设置vnc密码
1 2 3 4 5 6 7 8
[root@localhost ~]# vncpasswd Password: Verify: Would you like to enter a view-only password (y/n)? n A view-only password is not used # 这里不添加只读账号密码 # 每个不用的系统用户,设置密码时,需要切换到该用户下,执行此命令 # 如:su test 切换到test用户再执行上vncpasswd设置密码