5月30日课程
Posted jie2018
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了5月30日课程相关的知识,希望对你有一定的参考价值。
1.9 使用PuTTY远程连接Linux
1.10 使用xshell连接Linux
1.11 PuTTY密钥认证
1.12 xshell密钥认证
下载putty软件:
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-920c9e4e7c437080.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
PUTTY下载网址:https://www.putty.org/
然后安装
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-720d8ccffb535db7.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-04eded6a888a3d46.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-8b5b7950281a7af4.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-a72596f0cc8ea3aa.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-bcb29588532c6dc8.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-7edf1cc1f632368f.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击新建
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-b5837eea24f62388.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
设置连接主机名称 输入主机ip 端口号 然后点击确定
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-98b653c1c5bb4876.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
会自动保存到常用会话选项里面
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-64ea65fb2ba1247d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
选择需要连接的主机 点击连接
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-2e5610e44026d13e.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击一次性接收
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-aa42e89406e7fc22.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
输入用户名 点击确定
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-ef4907f439fc00d9.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
输入密码
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-1c0153b7170fafca.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
可以正常连接到主机
接下来设置putty 通过密钥连接linux主机
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-fd010a2b4b8386b1.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-64c7b0a82fab09a4.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-9ba0bea260dfc2e5.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-4b7fec1dde02c314.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-6cb4c4c196fa777c.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-239c72a218941b94.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-d957c38f44c6727d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
截图有错误;authorized_kyes 这个是正确的。
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-b7ee0710e637e82b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
右击鼠标就能复制
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-ac7f21dbc20cc18d.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
按键:esc 操作shift+: 然后输入wq 保存
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-07d4de982c0e4119.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-cdaae3b4609c284a.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-9ee394a5e4df4a92.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-b7c5f8ef7d298bad.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-3089ab8810624b35.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
加载刚刚保存的私钥文件 然后在session选项操作保存跟主机相关秘钥文件:如下图
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-0ba79984e4be7c6c.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
配置好秘钥文件(如上图) 在这里添加上主机ip 点击保存 然后点击open 就可以以秘钥身份登录主机了。
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-4411a45036bcce83.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
输入用户名 在输入私钥匙密码登录主机了。
putty 缺点 不支持多窗口登录切换, 配置好秘钥不能直接登录, xshell 可以配置好秘钥直接登录不用输入密码
接下来设置xshell 秘钥登录
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-a5dc1d6d4ad96367.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击新建用户秘钥
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-0d51a82b1a4a217f.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
设置密码复杂度 这里保存默认设置了
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-324d09ee8fc9cc33.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
生成公钥 鼠标钥动一动
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-7f38f15b7a847c1b.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
设置私钥名称和密码
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-83736a7616bfffe1.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
生成公钥 在保存
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-8399fbe05f340273.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
复制公钥 复制公钥 前提要在主机新建一个文件如下图:
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-dd6990dd26a83e6b.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
新建好文件 还有设置文件权限 还要关闭系统防火墙:setenforce 0(临时关闭防火墙)
然后使用命令: vi /root/.ssh/authorized_keys 进入后添加公钥信息
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-70fdb957a26f315a.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
粘贴到主机里然后保存退出 vi里面 开头加上## 表示不生效
然后操作如下步骤 通过秘钥连接主机
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-d5cfea278ec4d4b6.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
方法里面:选择秘钥登录 ,输入用户主机用户root 、用户秘钥选择刚生成的私钥, 在输入私钥密码。
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-732d0117b4751d39.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
点击连接
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-a1c76252efcd12b1.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
使用秘钥登录
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-b5dcd1a80aeb9731.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
输入私钥密码 确定登入
![技术分享图片](https://upload-images.jianshu.io/upload_images/12429802-2ed5d873c7414aac.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
在不输入用户密码下使用密钥成功登录
以上是关于5月30日课程的主要内容,如果未能解决你的问题,请参考以下文章
课程目录9月30日,加微信客服yiwangqingshen95拥有知识库