设为首页 收藏本站
查看: 489|回复: 0

[经验分享] liunx ssh与vncview安全"行"

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2014-9-10 09:54:59 | 显示全部楼层 |阅读模式
  SSH 为 Secure Shell 的缩写,由 IETF 的网络工作小组(Network Working Group)所制定;SSH 为建立在应用层和传输层基础上的安全协议。SSH 是目前较可靠,专为远程登录会话和其他网络服务提供安全性的协议。利用 SSH 协议可以有效防止远程管理过程中的信息泄露问题。

     VNC (Virtual Network Computer)是虚拟网络计算机的缩写。VNC 是一款优秀的远程控制工具软件,由著名的 AT&T 的欧洲研究实验室开发的。VNC 是在基于 UNIX 和 Linux 操作系统的免费的开源软件,远程控制能力强大,高效实用,其性能可以和Windows 和 MAC 中的任何远程控制软件媲美。 在 Linux 中,VNC 包括以下四个命令:vncserver,vncviewer,vncpasswd,和 vncconnect。大多数情况下用户只需要其中的两个命令:vncserver 和 vncviewer。但是VNC 是明文的,不安全的.连接过程可能会被窃听,干扰.可以使用SSH通道加密,然后再由远程主机的回环地址通信,加大了安全性。

   下面就给大家演示一个ssh配合vncview访问的例子。下面就给大家演示一个ssh配合vncview访问的例子。这个例子适合redhat|Centos|OEL6以上本,redhat|Centos|OEL5配置不一样。
   1.服务端设置(192.168.1.102)
   1.1 安装vnc


    [iyunv@cent2 ~]# yum -y install tigervnc tigervnc-server  
    Loaded plugins: fastestmirror, refresh-packagekit, security  
    …………………..  
    …………………  
    Complete!  
    [iyunv@cent2 ~]# rpm -qa tigervnc  
    tigervnc-1.1.0-8.el6_5.x86_64  
    [iyunv@cent2 ~]#  

   1.2 修改参数文件


    [iyunv@cent2 ~]# cat /etc/sysconfig/vncservers   
    # 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="2:myusername"  
    # VNCSERVERARGS[2]="-geometry 800x600 -nolisten tcp -localhost"  
      
    VNCSERVERS="1:oracle 2:grid"  
    VNCSERVERARGS[1]="-geometry 1024x768 -nolisten tcp"  
    VNCSERVERARGS[2]="-geometry 1024x768 -nolisten tcp -SecurityTypes None"  
    [iyunv@cent2 ~]#  

       主要添加了2个vnc用户,oracle用户和grid用户,VNCSERVERARGS[1]表示oracle用户分辨率和协议。但是VNCSERVERARGS[2]代表的grid用户不用输入密码就可以连接。
  
   1.3 为用户设计vnc密码


    [iyunv@cent2 ~]# su - oracle  
    [oracle@cent2 ~]$   
    [oracle@cent2 ~]$ vncpasswd  
    Password:  
    Verify:  
    [oracle@cent2 ~]$   
    [oracle@cent2 ~]$ exit  
    logout  
    [iyunv@cent2 ~]#   
    [iyunv@cent2 ~]# su - grid  
    [grid@cent2 ~]$   
    [grid@cent2 ~]$ vncpasswd  
    Password:  
    Verify:  
    [grid@cent2 ~]$  

      这样做的好处,就是系统用户密码和vnc用户密码分开。
1.4 启动vnc


    [iyunv@cent2 ~]# service vncserver start  
    Starting VNC server: 1:oracle xauth:  creating new authority file /home/oracle/.Xauthority  
      
    New 'cent2:1 (oracle)' desktop is cent2:1  
      
    Creating default startup script /home/oracle/.vnc/xstartup  
    Starting applications specified in /home/oracle/.vnc/xstartup  
    Log file is /home/oracle/.vnc/cent2:1.log  
      
    2:grid xauth:  creating new authority file /home/grid/.Xauthority  
      
    New 'cent2:2 (grid)' desktop is cent2:2  
      
    Creating default startup script /home/grid/.vnc/xstartup  
    Starting applications specified in /home/grid/.vnc/xstartup  
    Log file is /home/grid/.vnc/cent2:2.log  
      
    [  OK  ]  
    [iyunv@cent2 ~]#  
1.5 测试 SouthEast.jpg

如果要连接oracle用户,那就是5901了。这边只是测试下,tigervnc是否配置好。下面才是配置ssh方式的连接。
   
2.客户端设置(192.168.1.103)  2.1 window客户端   window客户端验证方式,我们用的工具是CRT
SouthEast.jpg

  如果图片,右键直接打开图片的URL好了,分比率挺大的图片。
   通过上面的设置,就把服务器的5901端口映射到本地的5901了,在用vnc工具的时候,就要连接本地了。
SouthEast.jpg

   大家看到了没有,这里连接的就是本地的127.0.0.1:5901了。
   2.2 liunx客户端   利用ssh 映射服务端(192.168.1.102)的5901端口 到 本地的5901端口
    [iyunv@cent1 Desktop]# ssh -L 5901:localhost:5901 192.168.1.102  
    The authenticity of host '192.168.1.102 (192.168.1.102)' can't be established.  
    RSA key fingerprint is ea:d9:cd:1e:5a:51:79:07:19:d2:e3:50:99:3f:35:a6.  
    Are you sure you want to continue connecting (yes/no)? yes  
    Warning: Permanently added '192.168.1.102' (RSA) to the list of known hosts.  
    Address 192.168.1.102 maps to localhost, but this does not map back to the address - POSSIBLE BREAK-IN ATTEMPT!  
    root@192.168.1.102's password:   
    Last login: Sun Sep  7 18:55:25 2014 from 192.168.1.101  
    [iyunv@cent2 ~]#  

   开启vncviewer


    root@cent1 Desktop]# vncviewer 127.0.0.1:5901  
      
    TigerVNC Viewer for X version 1.1.0 - built Feb  4 2014 05:24:41  
    Copyright (C) 1999-2011 TigerVNC Team and many others (see README.txt)  
    See http://www.tigervnc.org for information on TigerVNC.  
      
    Sun Sep  7 11:24:11 2014  
     CConn:       connected to host 127.0.0.1 port 5901  
     CConnection: Server supports RFB protocol version 3.8  
     CConnection: Using RFB protocol version 3.8  
      
    Sun Sep  7 11:24:17 2014  
     TXImage:     Using default colormap and visual, TrueColor, depth 24.  
     CConn:       Using pixel format depth 24 (32bpp) little-endian rgb888  
     CConn:       Using Tight encoding  
SouthEast.jpg
    这样就配置好了,可以在liunx里面登陆了。






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-24635-1-1.html 上篇帖子: ubuntu 12.04下安装中文输入法 下篇帖子: linux查看文件句柄使用情况
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表