一、实验环境布置
两台虚拟机,一台作为服务端,一台作为
client:
westos_client.westos.com 172.25.254.10
server:
westos_node1.westos.com 172.25.254.20
$sudo ifconfig ##查看 ip 地址
$sudo nm-connection-editor ##设定 ip 地址
$sudo hostnamectl set-hostname ##设定主机名称
二、Openssh 服务的基本信息
1.作用:
在企业中的运维工作,不是 1v1 的运维,运维工程师基本都是 1vN。在运维工程师对服务器进行管理时,需要通过网络登陆远程主机,需要通过网络在远程主机中开启 shell 来进程操作,远程主机必须提供这样的开启 shell 的方式。所以就有了 openssh 服务来提供解决这个问题的方法。远程主机中安装了 openssh 并开启了这个服务,那么我们就可以通过网络来连接这台主机了。
2.软件包名称
openssh-server
3.服务名称
sshd
4.客户端
ssh
$sudo ssh 172.25.254.20 -l root #172.25.254.20 远程主机 ip
#-l login 登陆
#root 远程主机的超级用户
[root@westos_client ~]# 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` #输入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 en