SSH安全协议

SSHD服务node

介绍:SSH 协议:安全外壳协议。为 Secure Shell 的缩写。SSH 为创建在应用层和传输层基础上的安全协议。安全

默认端口22服务器

 

做用dom

sshd服务使用SSH协议能够用来进行远程控制, 或在计算机之间传送文件 ssh

相比较以前用telnet方式来传输文件要安全不少,由于telnet使用明文传输,是加密传输。ide

第一步、安装

系统默认安装而且开机自启测试

[root@localhost songqi]# yum install openssh openssh-clients openssh-server openssh-askpass加密

SSH 配置文件

SH 经常使用配置文件有两个/etc/ssh/ssh_config 和/etc/sshd_config。spa

ssh_config 为客户端配置文件code

sshd_config 为服务器端配置文件

从节点:接收秘钥的主机

[root@ken-node2 ~]# ls .ssh/
authorized_keys

authorized_keys文件内容和主节点的 id_rsa.pub文件内容一致,即保存了公钥信息。

使用ssh免密登录远程主机

 第一步、生成秘钥

[root@localhost /]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
/root/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
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:
05:01:72:e7:b7:74:aa:62:ab:b1:6f:f6:dc:8a:1f:cb root@localhost.localdomain
The key's randomart image is:
+--[ RSA 2048]----+
| . o.+. |
| o o . |
| . + . |
| + + |
| S o |
| . |
| . o o |
| +o* + |
| o=+oE.. |
+-----------------+

第二步、发送秘钥给目标主机

[root@localhost /]# ssh-copy-id 192.168.7.2

第一次须要密码(客户端密码)

第三步、测试

能够免密登录目标主机或使用scp命令