一.指定在2024/04/15 09:00将时间写入testmail. test文件中。
1.使用at交互命令
2.创建testmail. test文件
3.写入当前时间
4.Ctrl+d保存退出
二.指定每天凌晨4:00将该时间点之前的日志信息备份到根目录下(/var/log/messages),备份后日志文件名显示格式logfileYY-MM-DD-HH:MM:SS
1 .打开配置文件
vim /etc/crontab
2.增加任务
3.按:wq保存退出
三.配置ntp时间服务器,确保客户端主机能和服务主机同步时间
服务端:192.168.119.128
1.编辑配置文件
2.重启进程
3.查看进程
4.关闭防火墙和SELINUX(本机已经关闭,仅写出命令)
客户端:192.168.119.129
1.修改配置文件
2.修改时间
3.重启进程
4.追溯
四.配置ssh免密登录,能够实现客户端主机通过服务器端的redhat账户进行基于公钥验证方式的远程连接
1.定位node1(客户端)创建Redhat账户,并制作公私钥对
2.上传公钥
3.测试
[root@node1 ~]# useradd redhat
[root@node1 ~]# passwd redhat
更改用户 redhat 的密码 。
新的密码:
无效的密码: 密码少于 8 个字符
重新输入新的密码:
passwd:所有的身份验证令牌已经成功更新。
[root@node1 ~]# su redhat
[redhat@node1 root]$ ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/redhat/.ssh/id_rsa):
Created directory '/home/redhat/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/redhat/.ssh/id_rsa
Your public key has been saved in /home/redhat/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:BuiupJ+iw0pnMChv6DmvCc7STh1HCUJs8gN+dBSVWAs redhat@node1
The key's randomart image is:
+---[RSA 3072]----+
| oo oE=o. |
|o oo =.o. |
|.=. o +. |
|..oo . . |
|oo..o . S |
|.ooo o . |
|+o=oo |
|XB*o |
|B%O. |
+----[SHA256]-----+
[redhat@node1 root]$ ssh-copy-id root@192.168.119.128
/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.119.128 (192.168.119.128)' can't be established.
ED25519 key fingerprint is SHA256:l91NRfMcJ/H7FnN7ifXVSzjSLz6AIPGeZwdOb7xlpaE.
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
root@192.168.119.128's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh 'root@192.168.119.128'"
and check to make sure that only the key(s) you wanted were added.
[redhat@node1 root]$ ssh root@192.168.119.128
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 Jul 15 19:26:37 2023