RHCE 第二天

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

[root@localhost ~]# hostname server                           #修改服务器主机名
[root@localhost ~]# bash
[root@server ~]# vim /etc/chrony.conf                          #配置服务器主机
allow 192.168.0.0/16
local stratum 10

[root@server ~]# systemctl restart chronyd                  #服务器主机重启chronyd
[root@server ~]# date                                                   #查看此时服务器主机时间
Sat Aug 27 18:47:14 CST 2022

[root@localhost ~]# date                                           #查看此时客户端主机时间
Sat Aug 27 18:28:32 CST 2022
[root@localhost ~]# # vim /etc/chrony.conf               #配置客户端主机使其同步到服务器主机
pool 192.168.101.134 iburst
[root@localhost ~]# # systemctl restart chronyd        #重启客户端主机chronyd
[root@localhost ~]# # date                                         #查看此时客户端主机时间
Thu Dec  1 12:01:40 CST 2022
[root@localhost ~]# # date
Sat Aug 27 18:49:43 CST 2022

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

#制作秘钥对

root@localhost ~]# ssh-keygen -t rsa      
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):           
/root/.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 /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Z9/0qRdVkDDH8KmIeBBMhDIckSc7XpFD2CYLbhN5PIE root@localhost
The key's randomart image is:
+---[RSA 3072]----+
| .*Oo*+     ++oo |
|.EO+O ..     +o..|
|..oX.o.       o .|
| ++ .  o . . .  .|
|...o  . S + . . .|
|  .    . o . o o.|
|            . ..o|
|              .. |
|             ..  |
+----[SHA256]-----+

#发送秘钥到服务端主机redhat用户的/root/.ssh/id_rsa.pub目录下

[root@localhost ~]# ssh-copy-id -i redhat@192.168.101.134
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
/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
redhat@192.168.101.134's password: 

Number of key(s) added: 1

Now try logging into the machine, with:   "ssh 'redhat@192.168.101.134'"
and check to make sure that only the key(s) you wanted were added.

#在客户端远程登录服务端的radhat用户

[root@localhost ~]# ssh redhat@192.168.101.134
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 login: Sat Aug 27 19:32:09 2022 from 192.168.101.1
[redhat@server ~]$ 
 

 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值