SSH带外管理
ssh服务,一种远程管理连接工具,在CentOS7系统中默认安装并开机自启的。
SSH(Secure Shell)是一种安全通道协议,主要用来实现字符界面的远程登录,远程复制等功能。
监听tcp的22号端口。软件包名称:openssh
配置文件目录:/etc/ssh,
sshd_config 服务端配置文件;
ssh_config 客户端配置文件。
客户端提供:ssh、scp、sftp命令
服务端提供:sftp服务、ssh服务
sshd_config:
Port 22 #监听端口
AddressFamily any #ip地址版本
ListenAddress 0.0.0.0 #监听地址,ipv4
ListenAddress :: #监听地址,ipv6
PermitRootLogin yes #是否允许root用户登录
MaxAuthTries 6 #重新连接最大次数
MaxSessions 10 #建立不同用户的会话的最大个数
PubkeyAuthentication yes #是否启用公钥对验证登录
AuthorizedKeysFile .ssh/authorized_keys #存储客户端公钥信息的文件
PasswordAuthentication yes #是否启用密码验证登录
PermitEmptyPasswords no #是否允许空密码登录
UsePAM yes #启用系统用户及密码进行验证登录
UseDNS no #是否启用ssh内部的解析,会影响连接速度
登录方式配置
用户名密码登录
默认方式,直接可以使用
公钥验证登录
数据加密:
使用对端的公钥加密,接收端收到数据后,使用自己的私钥解密。作用是保证数据完整性。
数字签名:
私用自己的私钥加密,接收端收到数据后,使用发送端的公钥解密。作用是保证发送者的身份唯一性。
ssh客户端生成密钥对(交互式 疯狂敲回车)
[w@localhost ~]$ ssh-keygen -t rsa -N '' -f ./.ssh/id_rsa
Generating public/private rsa key pair.
./.ssh/id_rsa already exists.
Overwrite (y/n)? y
Your identification has been saved in ./.ssh/id_rsa.
Your public key has been saved in ./.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:mPoQ5VHepMkS+xbH3uAqoHu/ucaoh+hOGtFtDhz9Qr4 w@localhost.localdomain
The key's randomart image is:
+---[RSA 2048]----+
| . . . |
| . * * |
| . o = * = |
| o = + * = o |
|. + B = S o . |
| . = * . . |
|.o..Eo. . |
|+...+ooo |
|+oo+ o*o |
+----[SHA256]-----+
非交互式
w@localhost ~]$ ssh-keygen -t rsa -N '' -f /home/w/.ssh/id_rsa
Generating public/private rsa key pair.
/home/w/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Your identification has been saved in /home/w/.ssh/id_rsa.
Your public key has been sa

最低0.47元/天 解锁文章
371





