• vncserver 添加用户


    1.在vncserver设置登录用户的信息
     
    #vi /etc/sysconfig/vncservers
     
    VNCSERVERS="1:root 2:wt"
    此处添加用户
     
    VNCSERVERARGS[2]="-geometry 1280x1024-alwaysshared
    #vncserver -geometry 1280x1024
    设置vncserver的分辨率
    #vncserver -geometry 1280x1024
    设置vncserver的分辨率
    #vncserver -depth 8
    设置vncserver的色深
    #vncserver -depth 16
    设置vncserver的色深
    注意:-geometry 1024x768表示分辨率;-alwaysshared 表示允许多终端同时登陆
     
    # The VNCSERVERS variable is a list of display:user pairs.
    #
    # Uncomment the lines below to start a VNC server on display :2
    # as my 'myusername' (adjust this to your own).  You will also
    # need to set a VNC password; run 'man vncpasswd' to see how
    # to do that.
    #
    # DO NOT RUN THIS SERVICE if your local area network is
    # untrusted!  For a secure way of using VNC, see this URL:
    # http://kbase.redhat.com/faq/docs/DOC-7028
    
    # Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
    
    # Use "-localhost" to prevent remote VNC clients connecting except when
    # doing so through a secure tunnel.  See the "-via" option in the
    # `man vncviewer' manual page.
    VNCSERVERS="1:root 2:wt"
    VNCSERVERARGS[1]="-geometry 1280X1024"
    VNCSERVERARGS[2]="-geometry 1280X1024 -alwaysshared"
    # VNCSERVERS="2:myusername"
    # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"
    2. 切换到vnc登录中使用用户,然后配置密码,
     
    root@localhost /]#su wt
    [huilin@localhost /]$ vncserver :2
    You will require a password to access your desktops.
    Password:      输入vnc 连接密码
    Verify:        确认vnc密码
    xauth:  creating new authority file /home/huilin/.Xauthority
    New 'localhost.localdomain:2 (huilin)' desktop is localhost.localdomain:2
    Creating default startup script /home/huilin/.vnc/xstartup
    Starting applications specified in /home/huilin/.vnc/xstartup
    Log file is /home/huilin/.vnc/localhost.localdomain:2.log

    * 注意到每个用户都可以启动自己的 vncserver,每个用户可以启动多个 vncserver,

    用ip加端口号 ip:1,ip:2,ip:3 来标识。vncserver的大部分配置文件及日志文件都在用户home目录下.vnc目录下
    用户可以自定义启动号码如:
    [huilin@localhost /]$ vncserver  
    A VNC server is already running as :1

    3、打开对应的端口

    打开5901至5902 端口用于vnc  //如果需要配置更多的桌面,增加端口即可
    iptables -I INPUT -p tcp --dport 5901:5902 -j ACCEPT
    iptables -A INPUT -p tcp --dport 5901:5902 -j ACCEPT
    永久保存
    service iptables save


    4.启动vncserver服务
    1)启动全部桌面
       service vncserver start 
    2)启动某一桌面
       vncserver :1   //这里1表示第一个桌面

    5、停止vncserver服务

    1)停止全部桌面
       service vncserver stop
    2) 停止某一桌面
        vncserver -kill :1   //停止第1个界面,要用kill命令来杀掉界面1的进程

    6、查看当前有几个桌面在运行

        service vncserver status

    7、让vncserver服务随机启动

    默认状态下,vncserver服务不是开机自动启动,需要手工启动。
    chkconfig --list vncserver
    chkconfig vncserver on
    保存后,重启测试。

    8.客户端登录vncserver服务

    (1)先安装vncviewer来远程登录,

    (2)然后在地址栏输入“主机地址:1”(即主机IP加界面号的方式)

     

  • 相关阅读:
    sosreport -a --report
    笔记本用HDMI转VGA 使用双屏办公 听语音
    1080p就是1920*1080,2k就是2560*1440,4k就是3840*2160
    linux命令截取文件最后n行(所有命令)
    http://www.loongnix.org/index.php/Lbrowser
    tar解压某个目录 tar解压某个指定的文件或者文件夹
    解析CentOS 8上的Xrdp服务器安装
    CentOS、RHEL、Asianux、Neokylin、湖南麒麟、BC Linux、普华、EulerOS请参考“1.1 CentOS本地源配置”;
    Ubuntu18.04制作本地源
    js获取页面高度
  • 原文地址:https://www.cnblogs.com/mjorcen/p/3675529.html
Copyright © 2020-2023  润新知