rhce第一天(时间服务器,ssh免密登录,搭建web网站)

1.指定在每天凌晨4:00将该时间点之前的系统日志信息(/var/log/messages )备份到目录下/backup,备份后日志文件名显示格式logfileYY-MM-DD-HH-MM

[root@ssh-client ~]# mkdir /backup
[root@ssh-client ~]# vim /etc/crontab
# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name  command to be executed
0 6 * * * root /bin/cp /var/log/messages /backup/logfile date+\%Y-\%m-\%d\%H:\%M:\%S

2.配置ssh免密登陆:客户端主机通过redhat用户基于秘钥验证方式进行远程连接服务器的root用户

客户端:

创密钥:

[root@ssh-client ~]# ssh -keygen

传密钥给服务器root用户:

[root@ssh-client ~]# ssh-copy-id root@192.168.154.128
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/root/.ssh/id_rsa.pub"
The authenticity of host '192.168.154.128 (192.168.154.128)' can't be established.
ED25519 key fingerprint is SHA256:8gUs5oYIzYW3HpBvicfP4mqW1OIwa8AWgZi69aCkQtA.
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.154.128's password:

Number of key(s) added: 1

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

远程连接服务器root用户:

[redhat@localhost root]$ ssh 'root@192.168.130.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 failed login: Tue Mar 14 20:59:14 CST 2023 from 192.168.130.129 on ssh:notty
There was 1 failed login attempt since the last successful login.
Last login: Tue Mar 14 20:51:16 2023 from 192.168.146.1
[root@ssh-client ~]# 

3.搭建一个web网站,网站显示hello world内容

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值