时间服务器和远程控制作业

配置ntp时间服务器

服务端

# 配置客户端白名单
[root@node1 ~]# vim /etc/chrony.conf
#重启服务
[root@server ~]# systemctl restart chronyd

配置文件配置

# Allow NTP client access from local network.
allow 192.168.0.0/16

客户端

#配置文件,从服务器主机获取时间
[root@node1 ~]# vim /etc/chrony.conf 
#重启服务
[root@server ~]# systemctl restart chronyd

#测试
[root@node1 ~]# chronyc sources
MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 192.168.209.9                 3   6    17    16    +56us[  -47us] +/-  100ms


[root@node1 ~]# timedatectl status 
               Local time: 一 2023-07-17 23:30:21 CST
           Universal time: 一 2023-07-17 15:30:21 UTC
                 RTC time: 一 2023-07-17 15:30:21
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

配置文件变更:

# Use public servers from the pool.ntp.org project.
# Please consider joining the pool (https://www.pool.ntp.org/join.html).
server 192.168.209.9 iburst

shh认证登录

服务端:

#添加用户
[root@server messages]# useradd redhat
[root@server messages]# passwd redhat
更改用户 redhat 的密码 。
新的密码: 
无效的密码: 密码少于 8 个字符
重新输入新的密码: 
passwd:所有的身份验证令牌已经成功更新。 


客户端:

#生成密钥对
[root@node1 ~]# ssh-keygen -t rsa
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:jZNy3Y+mtHZNnO7sok2i4kM7YXKZrJy8F6dj6/C8Ofg root@node1
The key's randomart image is:
+---[RSA 3072]----+
|                 |
|                 |
|                 |
|         = .     |
|     ..oS o .. . |
|    . Xo..   o+  |
|   o.O *  o ++.  |
|    *+@. o.Bo.o  |
|    .BEO..+o.++  |
+----[SHA256]-----+

#上传公钥
[root@node1 ~]# ssh-copy-id redhat@192.168.209.9
/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.209.9's password: 

Number of key(s) added: 1

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

#测试
[root@node1 ~]# ssh redhat@192.168.209.9
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值