一.实验环境
horizon_carry 172.25.254.10
carry 172.25.254.20
ifconfig ##查看ip地址
nm-connection-editor ##设定ip地址
hostnamectl set-hostname ##设定主机名称
二.Openssh服务的基本信息
1.openssh作用
<1>在企业中的运维工作,不是1v1的运维,运维工程师基本都是1vN。
<2>在运维工程师对服务器进行管理时
需要通过网络登陆远程主机
需要通过网络在远程主机中开启shell来进程操作
远程主机必须提供这样的开启shell的方式
以上的需求由openssh服务来提供
<3>远程主机中安装了openssh并开启了这个程序,那么我们就可以通过网络来连接这台主机了。
2.软件包名称
openssh-server
3.服务名称
sshd
4.客户端
ssh 172.25.254.20 -l root # 172.25.254.20 远程主机ip
# -l login 登陆
#root 远程主机的超级用户
[root@Horizion_carry Desktop]# ssh 172.25.254.20 -l root
The authenticity of host '172.25.254.20 (172.25.254.20)'
can't be established.
ECDSA key fingerprint is
SHA256:+5Ikt8ZExrRdLzOg19xsL5PhAYPt8GB7umvLcSF/dlM.
Are you sure you want to continue connecting (yes/no)? yes #建立关系
Warning: Permanently added '172.25.254.20' (ECDSA) to the list of known hosts.
root@172.25.254.20's password: ##输入远程主机密码
Activate the web console with: systemctl enable --now cockpit.socket
Last login: Sat Apr 25 09:02:58 2020
[root@carry ~]# ##登陆成功
5.sshd服务端口
22/tcp
6.配置文件
/etc/ssh/sshd_config
三.Openssh服务的key认证
1.用户密码认证 (对称加密)
密码容易泄漏
容易忘记
2.密钥认证 (非对称加密)
安全
不会忘记密码
3.建立key认证的方式
<1> 建立key文件
位置 : 172.25.254.10主机
ssh-keygen ##建立认证key文件