4题作业 欧鹏互联的

 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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值