实验环境: 在RHEL 7.5 中模拟给两个用户 jerry、tom 配置vnc

Note

Unlike in previous Red Hat Enterprise Linux distributions, TigerVNC in Red Hat Enterprise Linux 7 uses the systemd system management daemon for its configuration. The /etc/sysconfig/vncserver configuration file has been replaced by /etc/systemd/system/vncserver@.service.

Installing VNC Server

To install the TigerVNC server, issue the following command as root

[root@vm-server ~]# yum install tigervnc-server

Configuring VNC Server

The VNC server can be configured to start a display for one or more users, provided that accounts for the users exist on the system, with optional parameters such as for display settings, network address and port, and security settings.

  1. A configuration file named /etc/systemd/system/vncserver@.service is required. To create this file, copy the /usr/lib/systemd/system/vncserver@.service file as root:

    [root@vm-server ~]# cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver-jerry@.service
    [root@vm-server ~]# cp /usr/lib/systemd/system/vncserver@.service /etc/systemd/system/vncserver-tom@.service
  2. Edit /etc/systemd/system/vncserver-USER@.service, replacing USER with the actual user name. Leave the remaining lines of the file unmodified. The -geometry argument specifies the size of the VNC desktop to be created; by default, it is set to 1024x768.

     34 [Unit]35 Description=Remote desktop service (VNC)36 After=syslog.target network.target37 38 [Service]39 Type=forking40 41 # Clean any existing files in /tmp/.X11-unix environment42 ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'43 ExecStart=/usr/sbin/runuser -l jerry -c "/usr/bin/vncserver %i -geometry 1366x768"44 PIDFile=/home/jerry/.vnc/%H%i.pid45 ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'46 47 [Install]48 WantedBy=multi-user.target
  3. Save the changes.
  4. To make the changes take effect immediately, issue the following command:

      [root@vm-server ~]# systemctl daemon-reload
  5. Set the password for the user or users defined in the configuration file. Note that you need to switch from root to USER first.

    [root@vm-server ~]# su - jerry
    [jerry@vm-server ~]$ vncpasswd
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? n
    A view-only password is not used
    [jerry@vm-server ~]$ exit
    logout
    [root@vm-server ~]# su - tom
    [tom@vm-server ~]$ vncpasswd
    Password:
    Verify:
    Would you like to enter a view-only password (y/n)? n
    A view-only password is not used
    [tom@vm-server ~]$ exit
    logout
    [root@vm-server ~]#
    

    Important
    The stored password is not encrypted; anyone who has access to the password file can find the plain-text password.

Starting VNC Server

To start or enable the service, execute the following command:

[root@vm-server ~]# systemctl start vncserver-jerry@:1
[root@vm-server ~]# systemctl start vncserver-tom@:2

You can also enable the service to start automatically at system start. Then, when you log in, vncserver is automatically started. As root, issue a command as follows:

[root@vm-server ~]# systemctl enable vncserver-jerry@:1
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver-jerry@:1.service to /etc/systemd/system/vncserver-jerry@.service.
[root@vm-server ~]# systemctl enable vncserver-tom@:2
Created symlink from /etc/systemd/system/multi-user.target.wants/vncserver-tom@:2.service to /etc/systemd/system/vncserver-tom@.service.
[root@vm-server ~]# 

检查服务状态

[root@vm-server ~]# systemctl status vncserver-jerry@\:1.service
● vncserver-jerry@:1.service - Remote desktop service (VNC)Loaded: loaded (/etc/systemd/system/vncserver-jerry@.service; enabled; vendor preset: disabled)Active: active (running) since Sun 2018-09-09 13:22:11 CST; 18min agoMain PID: 6971 (Xvnc)CGroup: /system.slice/system-vncserver\x2djerry.slice/vncserver-jerry@:1.service‣ 6971 /usr/bin/Xvnc :1 -auth /home/jerry/.Xauthority -desktop vm-server:1 (jerry) -fp catalogue:/etc/X11/fontpath.d -geometry 1366x768 ...Sep 09 13:22:08 vm-server systemd[1]: Starting Remote desktop service (VNC)...
Sep 09 13:22:11 vm-server systemd[1]: Started Remote desktop service (VNC).
[root@vm-server ~]# systemctl status vncserver-tom@\:2.service
● vncserver-tom@:2.service - Remote desktop service (VNC)Loaded: loaded (/etc/systemd/system/vncserver-tom@.service; enabled; vendor preset: disabled)Active: active (running) since Sun 2018-09-09 13:22:29 CST; 18min agoMain PID: 7598 (Xvnc)CGroup: /system.slice/system-vncserver\x2dtom.slice/vncserver-tom@:2.service‣ 7598 /usr/bin/Xvnc :2 -auth /home/tom/.Xauthority -desktop vm-server:2 (tom) -fp catalogue:/etc/X11/fontpath.d -geometry 1366x768 -pn ...Sep 09 13:22:25 vm-server systemd[1]: Starting Remote desktop service (VNC)...
Sep 09 13:22:29 vm-server systemd[1]: Started Remote desktop service (VNC).
[root@vm-server ~]#

At this point, other users are able to use a VNC viewer program to connect to the VNC server using the display number and password defined. Provided a graphical desktop is installed, an instance of that desktop will be displayed. It will not be the same instance as that currently displayed on the target machine.

参考:

https://access.redhat.com/doc...

测试

jerry vnc接入

tom vnc接入

后记:
vnc肯定不止这么一点,还有好多要学。
这东西很占资源,1个G的内存

Configure VNC in RHEL 7相关推荐

  1. Linux/ubuntu server 18.04 安装远程桌面--vnc server

    此文首发于我的个人博客:Linux/ubuntu server 18.04 安装远程桌面–vnc server - zhang0peter的个人博客 想装桌面端在服务器上的原因是我在终端中开chrom ...

  2. Centos5 install vnc

    2019独角兽企业重金招聘Python工程师标准>>> 很详细的install steps: http://wiki.centos.org/HowTos/VNC-Server#hea ...

  3. Centos7作为VNCserver,本地使用VNCViewer连接

    1.概念 VNC是一个远程连接工具 VNC is used to display an X windows session running on another computer. Unlike a ...

  4. CentOS 7 常用软件安装汇总

    基本指令: clear |清屏| pwd |显示当前路径| more |显示文本文档| uname -a |查看当前核心版本号| free |查看剩余内存| df -h |[查看磁盘剩余空间]| du ...

  5. 服务器升级debian9_如何在Debian 9上设置PageKite前端服务器

    服务器升级debian9 The author selected the Open Internet/Free Speech Fund to receive a donation as part of ...

  6. RHEL 6 下VNC Server 的安装配置

    发下牢骚: 在安装rhel 6 64Bit的系统时我有安装远程桌面,本远程桌面为系统自带的,可以通过VNC的客户端访问,只不过和VNCServer的访问方式有点不一样,rhel6自带的远程桌面访问方式 ...

  7. edxp显示未安装_如何在 Centos 8 / RHEL 8 上安装和配置 VNC 服务器

    在 Centos 8 和 RHEL 8 系统中,默认未安装 VNC 服务器,它需要手动安装.在本文中,我们将通过简单的分步指南,介绍如何在 Centos 8 / RHEL 8 上安装 VNC 服务器. ...

  8. linux服务器上svn的log_如何在 Centos 8 / RHEL 8 上安装和配置 VNC 服务器 | Linux 中国...

    在 Centos 8 和 RHEL 8 系统中,默认未安装 VNC 服务器,它需要手动安装.在本文中,我们将通过简单的分步指南,介绍如何在 Centos 8 / RHEL 8 上安装 VNC 服务器. ...

  9. 查看vnc端口_如何在 Centos 8 / RHEL 8 上安装和配置 VNC 服务器

    在 Centos 8 和 RHEL 8 系统中,默认未安装 VNC 服务器,它需要手动安装.在本文中,我们将通过简单的分步指南,介绍如何在 Centos 8 / RHEL 8 上安装 VNC 服务器. ...

最新文章

  1. 一个典型的后台软件系统的设计复盘——(二)如何id一个事物
  2. [Unity3D]关于NaN(Not a Number)的问题
  3. Android 网络连接状态的监控
  4. Android Handler原理
  5. Socket之UDP客户端【Python】
  6. 手把手教你用java完成文件、图片下载
  7. 服务器上出现应用程序错误。此应用程序的当前自定义错误设置禁止远程查看应用程序错误的详细信息(出于安全原因)。...
  8. java unexpected type_意外类型需要变量找到值(Unexpected type required variable found value)...
  9. filezilla server 下载、安装、配置教程(包含新版使用配置)
  10. PyCharm 下载/上传gitlab 代码
  11. 基于回声状态网络(ESN)的时间序列预测
  12. sql面试题,查询出每班每科最高分的学生
  13. python画流星_幻光流星
  14. 【转】光荣的传统,荣耀的历史,勇敢的心!
  15. 数据结构:字符串 C++
  16. Python数据类型变量命名format集合等
  17. jre是否支持html5,html5的结构
  18. 连锁百货企业数据分析系统建设方案
  19. 使用for循环显示出三角形及菱形
  20. 易语言教程数组删除成员和删除指定成员

热门文章

  1. iOS:授权用户定位NSLocationManager的使用
  2. 【利用存储过程和三层架构完成新闻发布】
  3. Linux 操作memcache命令行
  4. Visual Basic十年风云
  5. 《淘宝网开店 拍摄 修图 设计 装修 实战150招》一一2.8  黄金分割的三分法构图...
  6. vsftpd更新和修改版本号教程
  7. 读书笔记《程序员修炼之道》
  8. Ubuntu新版发布周期
  9. addActionError addFieldErrot addActionMessage 的区别
  10. 苹果iOS开发深入浅出Cocoa之类与对象