1、atd和crond两个任务管理程序的区
atd是一次性作业
crond是周期性作业
2、指定在2023/08/26 09:00将时间写入testmail.txt文件中
先输入
发现at出现 然后at>data >> /root/textmail.txt
最后ctrl+d退出
再拿atq命令查看
成功设置
3、指定在每天凌晨4:00将该时间点之前的系统日志信息备份到个目录下(/var/log/messages ),备份后日志文件名显示格式logfileYY-MM-DD HH-MM
输入命令
然后配置命令
最后查看命令是否生效
4、写出linux主机之间ssh免密登陆的过程
先在一台主机上输入ssh-keygen -t RSA
[root@localhost ~]# 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:M5leQ4l8G3AVzflBOwldSOg4CloldSQdOq6us85sX4o root@client
The key's randomart image is:
+---[RSA 3072]----+
| .+o=ooB++o|
| ...B... *oo|
| o= =o =.|
| o. *oo. o|
| o .S.+. |
| . o.+ . |
| . o |
| ooo o |
| oE=+ |
+----[SHA256]-----+
[root@localhost ~]#
将公钥发给另一台主机ssh-copy-id 加另一台主机的IP地址
需要另一台主机的密码
[root@localhost ~]# ssh-copy-id 192.168.213.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.213.129 (192.168.213.129)' can't be established.
ED25519 key fingerprint is SHA256:ulpeDmnJr2JQNZ9OEGWmomzI2oJ5yM7PYf+7I3ocmRc.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? tes^H^H^H
Please type 'yes', 'no' or the 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.213.129's password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '192.168.213.129'"
and check to make sure that only the key(s) you wanted were added.
最后进行远程登录:ssh + 另一台主机的IP地址,完成后输入ip a,ip地址与输入的一致,则登录成功。
[root@localhost ~]# ssh 192.168.213.129
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: Fri Jul 7 15:32:33 2023 from 192.168.213.1
[root@localhost ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether 00:0c:29:81:0c:ee brd ff:ff:ff:ff:ff:ff
altname enp3s0
inet 192.168.213.129/24 brd 192.168.213.255 scope global dynamic noprefixroute ens160
valid_lft 1180sec preferred_lft 1180sec
inet6 fe80::20c:29ff:fe81:cee/64 scope link noprefixroute
valid_lft forever preferred_lft forever