Unit9 文档
来源:互联网 发布:360企业云盘下载mac版 编辑:程序博客网 时间:2024/06/05 20:58
########################
####9.openssh-server####
########################
####1.openssh-server####
功能:让远程主机可以通过网络访问sshd服务,开始一个安全shell
####2.客户端连接方式####
ssh 远程主机用户@远程主机ip
[root@desktop0 ~]# ssh root@172.25.0.11
The authenticity of host '172.25.0.11 (172.25.0.11)' can't be established.
ECDSA key fingerprint is eb:24:0e:07:96:26:b1:04:c2:37:0c:78:2d:bc:b0:08.
Are you sure you want to continue connecting (yes/no)? yes ##连接陌生主机时需要建立认证关系
Warning: Permanently added '172.25.0.11' (ECDSA) to the list of known hosts.
root@172.25.0.11's password: ##远程用户密码
Last login: Mon Oct 3 03:13:47 2016
[root@server0 ~]# ##登陆成功
ssh 远程主机用户@远程主机ip -X ##调用远程主机图形工具![](http://img.blog.csdn.net/20170413034524866?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU3l4ODM0NzIyMjA3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
####3.sshkey加密####
1.生成公钥私钥
[root@server0 ~]# ssh-keygen ##生成公钥私钥工具
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):[enter] ##加密字符保存文件(建议用默认)
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): [enter] ##密钥密码,必须>4个字符
Enter same passphrase again: [enter] ##确认密码
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ab:3c:73:2e:c8:0b:75:c8:39:3a:46:a2:22:34:84:81 root@server0.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|o |
|E. |
|.. |
|. . o |
|.o. * . S |
|oo.o o . |
|+ =. . . |
|o. oo.+.. |
| ..o*. |
+-----------------+
[root@server0 ~]# ls /root/.ssh/
id_rsa id_rsa.pub
id_rsa ##私钥,就是钥匙
id_rsa.pub ##公钥,就是锁![](http://img.blog.csdn.net/20170413034653136?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU3l4ODM0NzIyMjA3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
2.添加key认证方式
[root@server0 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@172.25.0.11
ssh-copy-id ##添加key认证方式的工具
-i ##指定加密key文件
/root/.ssh/id_rsa.pub ##加密key
root ##加密用户为root
[root@server0 ~]# scp /root/.ssh/id_rsa root@172.25.0.10:/root/.ssh/![](http://img.blog.csdn.net/20170413034731731?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU3l4ODM0NzIyMjA3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
4.测试
[root@desktop0 ~]# ssh root@172.25.0.11 ##通过id_rsa直接连接不需要输入用户密码
Last login: Mon Oct 3 03:58:10 2016 from 172.25.0.250
[root@server0 ~]#![](http://img.blog.csdn.net/20170413035336349?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU3l4ODM0NzIyMjA3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
####4.提升openssh的安全级别####
1.openssh-server配置文件
/etc/ssh/sshd_config
78 PasswordAuthentication yes|no ##是否开启用户密码认证,yes为支持no为关闭![](http://img.blog.csdn.net/20170413035459273?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvU3l4ODM0NzIyMjA3/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/SouthEast)
48 PermitRootLogin yes|no ##是否允许超级用户登陆![](http://img.blog.csdn.net/20170413035535071)
49 AllowUsers student westos ##用户白名单,只有在名单中出现的用户可以使用sshd建立shell
50 DenyUsers westos ##用户黑名单![](http://img.blog.csdn.net/20170413035632838)
####9.openssh-server####
########################
####1.openssh-server####
功能:让远程主机可以通过网络访问sshd服务,开始一个安全shell
####2.客户端连接方式####
ssh 远程主机用户@远程主机ip
[root@desktop0 ~]# ssh root@172.25.0.11
The authenticity of host '172.25.0.11 (172.25.0.11)' can't be established.
ECDSA key fingerprint is eb:24:0e:07:96:26:b1:04:c2:37:0c:78:2d:bc:b0:08.
Are you sure you want to continue connecting (yes/no)? yes ##连接陌生主机时需要建立认证关系
Warning: Permanently added '172.25.0.11' (ECDSA) to the list of known hosts.
root@172.25.0.11's password: ##远程用户密码
Last login: Mon Oct 3 03:13:47 2016
[root@server0 ~]# ##登陆成功
ssh 远程主机用户@远程主机ip -X ##调用远程主机图形工具
ssh 远程主机用户@远程主机ip command ##直接在远程主机运行某条命令
####3.sshkey加密####
1.生成公钥私钥
[root@server0 ~]# ssh-keygen ##生成公钥私钥工具
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):[enter] ##加密字符保存文件(建议用默认)
Created directory '/root/.ssh'.
Enter passphrase (empty for no passphrase): [enter] ##密钥密码,必须>4个字符
Enter same passphrase again: [enter] ##确认密码
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ab:3c:73:2e:c8:0b:75:c8:39:3a:46:a2:22:34:84:81 root@server0.example.com
The key's randomart image is:
+--[ RSA 2048]----+
|o |
|E. |
|.. |
|. . o |
|.o. * . S |
|oo.o o . |
|+ =. . . |
|o. oo.+.. |
| ..o*. |
+-----------------+
[root@server0 ~]# ls /root/.ssh/
id_rsa id_rsa.pub
id_rsa ##私钥,就是钥匙
id_rsa.pub ##公钥,就是锁
2.添加key认证方式
[root@server0 ~]# ssh-copy-id -i /root/.ssh/id_rsa.pub root@172.25.0.11
ssh-copy-id ##添加key认证方式的工具
-i ##指定加密key文件
/root/.ssh/id_rsa.pub ##加密key
root ##加密用户为root
172.25.0.11 ##被加密主机ip
[root@server0 ~]# scp /root/.ssh/id_rsa root@172.25.0.10:/root/.ssh/
4.测试
[root@desktop0 ~]# ssh root@172.25.0.11 ##通过id_rsa直接连接不需要输入用户密码
Last login: Mon Oct 3 03:58:10 2016 from 172.25.0.250
[root@server0 ~]#
####4.提升openssh的安全级别####
1.openssh-server配置文件
/etc/ssh/sshd_config
78 PasswordAuthentication yes|no ##是否开启用户密码认证,yes为支持no为关闭
48 PermitRootLogin yes|no ##是否允许超级用户登陆
49 AllowUsers student westos ##用户白名单,只有在名单中出现的用户可以使用sshd建立shell
50 DenyUsers westos ##用户黑名单
0 0
- Unit9 文档
- unit9
- unit9
- unit9
- unit9
- Unit9
- unit9 practice
- unit9 ssh
- unit9练习题
- Linux Unit9
- Unit9-problem-分数类
- Unit9-problem-一元一次方程
- Unit9-problem2 时间类
- linux初学 unit9
- linux初学 unit9 练习
- Unit9 作业练习
- Linux unit9-apache
- 西部开源运维学习unit9
- chgrp命令
- 一线触摸tslib移植详解
- chown命令
- iOS常用第三方库大全
- Apache访问日志详解
- Unit9 文档
- java高并发
- centos图形界面的开启和关闭
- 题目:有三个线程分别打印A、B、C,请用多线程编程实现,在屏幕打印10次ABC
- Unit10 文档
- Unit11 文档
- java中编码与解码分别指什么? 如何向非技术人员解释 Unicode 是什么?
- Unit12 文档
- Unit13 文档