HCLE--虚拟机安装ntp等相关服务出现报错解决和通过SSH实现免密登录

.1 在服务端主机上安装ntp服务:

yum install ntp

1.2 修改/etc/ntp.conf文件,将默认的ntp服务器地址替换为可用的ntp服务器地址。例如:

server ntp1.aliyun.com iburst server ntp2.aliyun.com iburst server ntp3.aliyun.com iburst

1.3 启动ntp服务并将其设置为开机自启动:

systemctl start ntpd systemctl enable ntpd

1.4 在客户端主机上安装ntp服务,并将其配置为同步服务端主机的时间:

yum install ntp ntpdate [服务端IP地址]

  1. 配置ssh免密登陆,能够通过客户端主机通过redhat用户和服务端主机基于公钥验证方式进行远程连接的步骤如下:

检查 更新后找不到ntp包 于是掉头检查了yum源 没有问题 

问了gtp发现二者存一即可

2.1 在客户端主机上使用ssh-keygen命令生成密钥:

ssh-keygen -t rsa

[root@localhost ~]# ssh-keygen
Generating public/private rsa key pair.

Enter file in which to save the key (/root/.ssh/id_rsa): Created directory '/root/.ssh'.
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:
SHA256:irRO8IKD7MTtVa4b1xAAzaQTZ/woxYHq+I6KNBYS01o root@localhost.localdomain
The key's randomart image is:
+---[RSA 3072]----+
|   oO*.          |
| . .=*.          |
|o Eo. o.         |
| * ... ..        |
|=.. o  oS        |
|*oo+ oo.o        |
|+O..=o.o .       |
|*o++. +          |
|=o...o.          |
+----[SHA256]-----+

 发现防火墙问题 检查防火墙        

2.2 将生成的公钥(默认为~/.ssh/id_rsa.pub)复制到服务端主机上的~/.ssh/authorized_keys文件中:上传秘钥

 

成功


2.3 修改服务端主机的ssh配置文件/etc/ssh/sshd_config,确保以下选项被启用:

PubkeyAuthentication yes AuthorizedKeysFile .ssh/authorized_keys

2.4 重启ssh服务:

systemctl restart sshd

​​​​​​​测试

[redhat@client .ssh]$ ssh 192.168.227.128
The authenticity of host '192.168.227.128 (192.168.227.128)' can't be established.
ED25519 key fingerprint is SHA256:IjiKi+oexrRWTbUACwNqXYQvu2F8yakPx49b7PW9lto.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.227128' (ED25519) to the list of known hosts.
redhat@192.168.227.128's password: 
Activate the web console with: systemctl enable --now cockpit.socket
 
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
Last login: Sat Apr  18 11:10:12 2023
[redhat@server ~]$ 

  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

kaituozhizzz

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值