RHCE网络服务第二次

1.配置ntp时间服务器,确保客户端主机能和服务主机同步时间

客户端主机(添加要同步时间的服务器的IP)

服务器主机 

 

 客户端主机

 重启(systemctl restart chronyd)

并修改服务器时间,(date 121212122002.30)

用客户端尝试同步(chronyc ntpada;chronyc sources)

看是否成功

 

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

[root@root ~]# su rhce                                 \\登录普通用户rhce
[rhce@root root]$ 
[rhce@host root]$ ssh-keygen -t rsa                          \\在客户端主机下创建密钥对
Generating public/private rsa key pair.
Enter file in which to save the key (/home/rhce/.ssh/id_rsa): 
/home/rhce/.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 /home/rhce/.ssh/id_rsa.
Your public key has been saved in /home/rhce/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:BdGX5lOjocQVDaAKc5MvT9aKE4gpmpE90QQ4fq1m9HM redhat@host
The key's randomart image is:
+---[RSA 3072]----+
| ....   o+.o+=   |
|o  o   . o+ = +  |
|... = + ...= + . |
| + * * + o. +    |
|+ B + + S .  .   |
|.+ = o E .       |
|o o   = o        |
|       .         |
|                 |
+----[SHA256]-----+                                                    
之后将此密钥对中的公钥发送至服务端

[rhce@host root]$ ssh-copy-id -i /home/rhce/.ssh/id_rsa.pub root@192.168.242.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/redhat/.ssh/id_rsa.pub"
The authenticity of host '192.168.242.129 (192.168.242.129)' can't be established.
ECDSA key fingerprint is SHA256:T7/sEALD9Zt772x20p8C6TgbsH+/J4RjD5lDASQ/aVE.
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
password: 
 
Number of key(s) added: 1
 
Now try logging into the machine, with:   "ssh 'root@192.168.242.129'"
and check to make sure that only the key(s) you wanted were added.
 
在服务端的/root/.ssh/目录下查看是否接收到此公钥
[root@sever ~]# cd .ssh/
[root@sever .ssh]# ll
total 4
-rw-------. 1 root root 565 Aug 28 07:20 authorized_keys
 
尝试基于公钥的远程免密码登录
[rhce@host root]$ ssh rhce@192.168.242.129
Activate the web console with: systemctl enable --now cockpit.socket
 
This system is not registered to Red Hat Insights. See https://cloud.redhat.com/
To register this system, run: insights-client --register
 
Last failed login: Sun Aug 28 07:20:22 PDT 2022 from 192.168.242.150 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Sun Aug 28 07:14:11 2022 from 192.168.40.1
[rhce@sever ~]#                                                  \\出现sever即为完成

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值