远程连接Linux与密钥认证
2018-01-24 11:50
183 查看
快照
这里先介绍一个VMware的功能,快照功能,如果中途实验中有些误操作,又没办法还原,我们可以使用这个虚拟机的功能,快照功能。![](http://i2.51cto.com/images/blog/201801/24/887d8ff50eeb36e8f86cd491529a1727.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
仅限VMware虚拟机使用。
远程连接
这里我们推荐两种远程连接工具Putty
下载地址:https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html
Xshell
下载地址:https://www.netsarang.com/products/xsh_overview.html
Putty 安装使用连接SSHD
下载完后打开是这样的
![](http://i2.51cto.com/images/blog/201801/24/825e7f49d31a21a4469d2a89a229f3ef.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
很简单的操作
![](http://i2.51cto.com/images/blog/201801/24/df4ac6d8b9c5f5d1e631fb5a371e5c40.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
再设置一下框内显示的行数
![](http://i2.51cto.com/images/blog/201801/24/950260d75577a90b877d653b55660758.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
设置字体、编码
![](http://i2.51cto.com/images/blog/201801/24/44e7237b51ef9e0d1de388c42007e91b.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/f4013517b8b486e8220bc0fc3afddddd.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
登录是会自动保存一个秘钥,这里我们不用管他直接选择“是”
![](http://i2.51cto.com/images/blog/201801/24/2693d566c62f12211750c7539f841245.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
完成后登录你装机器的设置的root账户和密码
![](http://i2.51cto.com/images/blog/201801/24/93cc95fe7095748b1512b715583e8358.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
is OK!
Xshell
个人使用免费,跟人性化的使用
简单设置连接
![](http://i2.51cto.com/images/blog/201801/24/e9a284c947ea98fbbae00f9577b53b9e.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/5e09d8562deca78ff55ee9f81768004e.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/d40e4fad8a05a8161b4735faa5d04030.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/cc84da5fa628895ca44af8695e66fe47.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/2b442acaea058ac4448fdc32ec84348d.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
is OK !
秘钥认证
putty 秘钥生成用到了putty key 工具 自动生成秘钥
认证方式 :公私钥 配对认证通过、公钥放服务器上,私钥自己保存好
![](http://i2.51cto.com/images/blog/201801/24/408612745ca2ab4506a799f256f55d1a.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/3b9363c37e05c8ed57b07f1ecf8f612b.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/4e40a30f904f26fd1df8906820f0f61b.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/e89c25d51c227115046759b5e29e6d4c.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
还要在你系统里保存你的公钥
公钥创建保存路径设置
步骤
mkdir /root/.shh
chmod 700 /root/.shh
vim /root/.shh/authorized_keys #一定要保存正确的路径位置
vim /etc/sysconfig/selinux -> SELINUX=disabled (永久关闭) 或者 命令行直接敲 ' setenforce 0 '
如图所示
![](http://i2.51cto.com/images/blog/201801/24/ee0edc8019e2ef85baa647f8aab742ea.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
然后在putty工具里使用秘钥登录
![](http://i2.51cto.com/images/blog/201801/24/8cd34d19b1c484dd4b4228e43f84e6dd.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/3464112624c375db69c0314da7eb0ab9.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/29be8cbbcbff23ca67b6ba5280114233.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
这里一定要点save 不然下次使用还要继续手动操作
![](http://i2.51cto.com/images/blog/201801/24/d25805224c3c244c00c48eeb913e95d4.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
这里就不会提示刚才那个框了
![](http://i2.51cto.com/images/blog/201801/24/d873d7479a9d1397fc8f46bdea4edf62.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
完成
Xshell
其实和putty 差不多
如图所示
![](http://i2.51cto.com/images/blog/201801/24/56cee071ed0af1890c2f9afbf5c24d6a.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/854ae24c464f26c4e5b043f461b8d500.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/a4672d5f8aea876ebf1c30d2e07c4030.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/26cb65048bd5b0a7d87284f44dd41087.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/d96a27697b85fcb01826ed40a3166641.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/ee49dcf96f3ea3fa57a7adfcf215291b.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/7f2b6d621e213a447dfe13d0317bdf27.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/22126d8b1773f5810d2e1b55a4521471.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
这里要先使用putty 把你的公钥手动加载到保存文件中去
![](http://i2.51cto.com/images/blog/201801/24/0aff9f0c643c1d01f7765c2ea0a29efe.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/8fe368c854b7a4038d9d691af256bc26.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
输入秘钥的密码,确定登录
![](http://i2.51cto.com/images/blog/201801/24/833e2ebce00179c88a19767097ced1ae.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
![](http://i2.51cto.com/images/blog/201801/24/3e3297a691104a9b9958568d7ffdc75d.png?x-oss-process=image/watermark,size_16,text_QDUxQ1RP5Y2a5a6i,color_FFFFFF,t_100,g_se,x_10,y_10,shadow_90,type_ZmFuZ3poZW5naGVpdGk=)
完成
关于 SELinux
临时关闭SElinux -> ‘’setenforce 0 ‘’getenforce 查看状态 = sestatus -v
永久关闭SElinux -> ' /etc/sysconfig/selinux ' -> SELINUX=disabled (关闭) enabled 是开启
相关文章推荐
- xshell,putty远程连接Linux并使用密钥认证
- 使用putty,xshell密码和密钥认证2种方式远程连接Linux-2
- L3 使用PuTTY,xshell远程连接Linux及PuTTY,xshell密钥认证
- PuTTY,Xshell,远程连接LInux系统及密钥认证
- 使用Xshell远程远程连接Linux与密钥认证
- putty、Xshell远程连接Linux以及密钥认证
- 使用PuTTY、xshell远程连接Linux,PuTTY、xshell密钥认证
- xshell、PuTTY 远程连接linux与密钥认证
- 使用puTTY和Xshell远程连接Linux以及密钥认证
- Linux学习总结(三)之 putty,xshell远程连接及密钥认证篇
- 10.18 PuTTY,Xshell,远程连接LInux系统及密钥认证
- 1.9 使用PuTTY远程连接Linux 1.10 使用xshell连接Linux 1.11 PuTTY密钥认证 1.12 xshell密钥认证
- 1.9 使用PuTTY远程连接Linux 1.10 使用xshell连接Linux 1.11 PuTTY密钥认证 1.12 xshell密钥认证
- 使用Putty远程连接Linux,使用xshell5连接Linux ;Putty密钥认证 ,xshell5密钥认证
- 一周第三次课 2017.10.18 使用PuTTY及xshell远程连接Linux并使用密钥认证
- 三、使用putty及xshell远程连接Linux、putty及xshell密钥认证
- 使用Putty远程连接Linux与密钥认证
- 使用PuTTY和xshell远程连接linux,Putty和xshell密钥认证
- PuTTY、Xshell 远程连接Linux与密钥认证方法
- 1.9 使用PuTTY远程连接Linux 1.10 使用xshell连接 Linux 1.11 PuTTY密钥认证 1.12 xshell密钥认证