配置时间服务器和远程登录服务器

该文介绍了如何配置Linux系统的时间服务器,通过修改chrony.conf文件同步阿里云时间源,并设置客户端同步。同时,文章详细阐述了如何在服务器上添加用户redhat,生成SSH密钥对,并将公钥传到服务器,实现无密码远程登录。
摘要由CSDN通过智能技术生成

配置时间服务器

在服务器端进行你向别的时间服务器进行时间的同步

vim /etc/chrony.conf ##打开对应的配置文件
server ntp.aliyun.com iburst ##在配置文件将时间同步的服务器改为阿里的时间服务器
allow 192.168.190.0/24 ## 在配置文件中允许客户端进行访问
systemctl restart chronyd ## 重启服务

注意:在配置文件中allow前面的#必须删除;allow后面加和客户端在同一个网段的地址
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在客户端进行向搭建的时间服务器进行时间同步

vim /etc/chrony.conf ##打开对应的配置文件
pool 192.168。190.129 iburst ##在配置文件将时间同步的服务器改为搭建的时间服务器
systemctl restart chronyd ## 重启服务
chronyc  sources  -v ## 测试是否同步

在这里插入图片描述

在这里插入图片描述

配置远程登录服务器

首先在服务器增加一个用户redhat

[root@server ~]# useradd redhat
[root@server ~]# 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): 
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:oKCz+ikccuPZ5VCN+MJ5oUtNp14T+cBNqnmWTIIxbMw root@node1
The key's randomart image is:
+---[RSA 3072]----+
|   +             |
|    E     .      |
|  .. =.+ =       |
| . .o.*.X .      |
|o  ..B XS=       |
|.+o B O B .      |
|+o.= O + .       |
|o.o.o o          |
|.oo              |
+----[SHA256]-----+

[root@node1 ~]# ssh-copy-id redhat@192.168.190.129
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.190.129 (192.168.190.129)' can't be established.
ED25519 key fingerprint is SHA256:7tSwZETzWZDpuoJqvEHCyE64IrhnTVKqjo7SxFoTIa0.
This key is not known by any other names
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
redhat@192.168.190.129's password: 

Number of key(s) added: 1

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

在这里插入图片描述
在这里插入图片描述

测试

[root@node1 ~]# ssh redhat@192.168.190.129
Register this system with Red Hat Insights: insights-client --register
Create an account or view all your systems at https://red.ht/insights-dashboard
[redhat@server ~]$ 

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值