Linux学习笔记(三) putty、xshell运用

上一节学习了centos7的静态ip配置,今天学习使用putty和xshell远程连接centos7
一.首先来学习使用putty
1.下载putty包
https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Linux学习笔记(三)  putty、xshell运用

  • 然后安装putty,这里不过多赘述,打开putty
    Linux学习笔记(三)  putty、xshell运用
    *在方框中填入自己的ip 192.168.40.133,下方方框起一个名字chinantfy-01
    然后左边点击translation 选择utf-8,返回session点击save,然后点open(之前要先打开虚拟机中的centos7)
    Linux学习笔记(三)  putty、xshell运用
    Linux学习笔记(三)  putty、xshell运用
  • 第一次链接会出现一个弹窗,点击是即可
    Linux学习笔记(三)  putty、xshell运用
  • 输入root,然后输入密码,就登陆成功了
    Linux学习笔记(三)  putty、xshell运用
    2.学习使用putty秘钥链接centos7
    首先开始菜单中找到puttygen
    Linux学习笔记(三)  putty、xshell运用
    打开之后点击generate生成秘钥
    Linux学习笔记(三)  putty、xshell运用
    Linux学习笔记(三)  putty、xshell运用
    Linux学习笔记(三)  putty、xshell运用
    *密码可以为空也可以输入,这里是测试用,我暂时就不设置密码,将上方方框中的公钥全选复制,先保存到一个文本中,然后分别点击下方两个save,保存公钥和私钥,并记住名字;
    接下来将公钥放入linux中,
    首先创建 /root/.ssh 文件夹,如果是其他用户,则文件路径为 /home/用户名/.ssh
    mkdir   /root/.ssh
    chmod 700   /root/.ssh
    vi  /root/.ssh/authorized_keys

    这一步是创建存放公钥的文件,执行以上命令之后,按i进入插入模式,将刚才保存的公钥复制进去,esc退出插入模式,:wq保存并退出
    Linux学习笔记(三)  putty、xshell运用
    接下来关闭selinux

    vi /etc/selinux/config

    Linux学习笔记(三)  putty、xshell运用
    将SELINUX后的enforcing 改为 disabled ,保存并退出,输入 init 6 重启centos7
    Linux学习笔记(三)  putty、xshell运用
    Linux学习笔记(三)  putty、xshell运用
    这时候关闭putty重新打开
    点击刚才的chinantfy-01 然后点击load
    Linux学习笔记(三)  putty、xshell运用
    接下来点击左侧的auth
    Linux学习笔记(三)  putty、xshell运用
    选择刚才保存的私钥名称
    返回session点击save保存配置,open打开putty窗口
    输入用户名root,
    Linux学习笔记(三)  putty、xshell运用
    由于之前没有设置密码,直接就登陆了centos7
    以上就是使用putty连接centos7的方法,用户名加密码登陆以及秘钥登陆
    二.xshell 连接centos7
    1首先下载xshell
    https://www.netsarang.com/products/xsh_overview.html
    安装完成之后打开
    Linux学习笔记(三)  putty、xshell运用

点击上方工具,新建用户秘钥生成向导
Linux学习笔记(三)  putty、xshell运用
Linux学习笔记(三)  putty、xshell运用
填写密钥名称和密码,我这里名字为默认,密码留空
Linux学习笔记(三)  putty、xshell运用
与前面putty使用一样,将公钥全选复制保存,
Linux学习笔记(三)  putty、xshell运用
2.接下来先学习xshell的账号密码链接centos7
Linux学习笔记(三)  putty、xshell运用
点左上角新建
Linux学习笔记(三)  putty、xshell运用
名称自定义,主机填ip地址
Linux学习笔记(三)  putty、xshell运用
点左边终端,编码选择utf-8
Linux学习笔记(三)  putty、xshell运用
点连接用户身份验证,输入centos7的账号、密码,Linux学习笔记(三)  putty、xshell运用
完成后选择刚刚创建的chinantfy-01连接
第一次连接也会弹窗,选择接受并保存即可
Linux学习笔记(三)  putty、xshell运用
这里就顺利登陆了,
3.上面学习了xshell用户密码连接,和秘钥对生成,接下来学习使用秘钥连接xshell
输入
vi /root/.ssh/authorized_keys
再次编辑秘钥文件

Linux学习笔记(三)  putty、xshell运用
i进入插入模式,将刚才用xshell创建的公钥复制进来,这里我为了以后好区分,分别加入了备注
Linux学习笔记(三)  putty、xshell运用
esc退出插入模式,:wq保存并退出
点击xshell左上角加号
在chinantfy-01上右键属性
Linux学习笔记(三)  putty、xshell运用
用户身份验证,方法选择public key ,用户密钥选择刚才生成的密钥然后点击确定
Linux学习笔记(三)  putty、xshell运用
由于没有设置密钥的登陆密码,所以直接就以root用户连接到了centos7;
以上就是分别用putty和xshell连接centos7的方法及操作步骤,需要注意的是,公钥要复制准确,vi /root/.ssh/authorized_keys 这个命令及文件路径要准确,一开始练习的时候因为不细心,这两个问题经常出错,一定要注意。

转载于:https://blog.51cto.com/13569831/2064404

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值