Current location - Education and Training Encyclopedia - Education and training - Red Hat linux Challenge (1)
Red Hat linux Challenge (1)
order

I participated in a Red Hat linux Challenge some time ago, and made some summaries here. Because it's about the basics of linux, I won't go into it. Let's discuss the topic of the semi-finals with you. (This article tries to restore the real competition environment.)

First of all, let me introduce the Red Hat Linux Challenge (ps: Inspur Advertising).

Red Hat is the world's leading provider of open source solutions, relying on community strength to provide customers with stable, reliable and high-performance cloud technology, Linux, middleware, storage and virtualization products. Red Hat also provides award-winning support, training and consulting services. As a center closely connecting global enterprises, partners and open source communities, Red Hat is committed to effectively releasing its valuable resources by providing customers with practical and innovative technical products, so as to promote business growth and lay a solid foundation for future IT development. In the past few years, more than 65,438+00,000 college students have participated in the Red Hat Red Hat Challenge, further understanding open source and improving red hat skills. In 20 19, Red Hat and Zhihui Yunxiao, an authorized partner of Red Hat College, jointly held the new Red Hat Challenge. It is hoped that through this 20 19 Red Hat Challenge, more and more schools and students will participate in the tide of open source, get in touch with and learn more red hat technologies, and promote the further development of open source.

20 19 red hat challenge is divided into two stages: regional competition and national finals. ● Regional competition content: The basic knowledge of Red Hat LINUX will be the main knowledge, and the main knowledge points will refer to the course content of Red Hat Certification System Administrator and Red Hat Certification Engineer. Authorized Red Hat Academy partners can add some other knowledge points of Red Hat course according to actual needs. ● Red Hat Finals: 70% will be based on Red Hat certified engineers, and 30% will be added with relevant knowledge points of Red Hat Ansible course.

Tips: Interested students can search on their own Baidu and look forward to your participation.

The first question-cracking the root password

This rematch, like RHCSA, used to crack the password before answering the questions, which means that if the password is not cracked successfully, we can't answer the questions down, so let's start with cracking the password. (The local environment is RHEL7.6)

Press the up and down keys when entering the picture below.

There is no countdown now. Press the e key to enter.

Scroll down, find a line starting with linux 16, and move the cursor to the end of the line.

Delete ro at the end of the line and change it to rwrd.break

ctrl+x

Then enter the following command.

chroot sysroot/

Echo "Fill in the password you changed here" | passwd-stdinroot

Touch/. Autorelabel # selinux will relabel the system files.

The last step is very important. Many students forget it easily. The result of wrong input or no input is that the system can't start normally.

Enter exit twice to exit.

the second question

Setting of host name

Hostnamectl set-hostname # hostname

This question is preceded by hostnamectl? Set-hostname desktop.group8.example.com # IP address dns gateway These can be modified by modifying the configuration file.

The first modification method

Vim/etc/sysconfig/network-scripts/ifcfg-eth0 # is ifcfg-ens33 in my environment.

Ip address

Network mask or prefix

Gateway (gateway)

BOOTPROTO has three states:/kloc-0 1.dhcp2.static3.none

Remember to turn ONBOOT here, that is, yes.

After saving and exiting, remember to restart the network service system ctl and restart the network.

Then use ifconfig to check whether the IP address gateway dns settings are correct.

The second modification method is also the simplest graphical modification method in my opinion. Open the terminal and enter nm-connection-editor.

Double-click ens33

Locate the IPv4 settings and modify the corresponding option boxes. After input, save.

Systemctl restarts the network.//Restart the network and use ifconfig to check whether the corresponding ip gateway is correct.

Third question

I naively think that it can be easily deleted by using rm -rf command. Finally, I found that there are files that cannot be deleted with root permission, so I thought of the concept of hidden permission.

I found out that I really have the right to hide.

Lsattr file path # View file hidden permissions

Chattr +/- ai file path # Add or remove hidden permissions for files.

Answer: Append only. Data can only be appended after this file, and no process is allowed to overwrite or truncate this file. If the directory has this attribute, the system will only allow files to be created and modified in the directory, and will not allow any files to be deleted.

I: That is immutable. The system does not allow any modification to this file. If the directory has this attribute, then any process can only modify the files in the directory, and it is not allowed to create or delete files.

Therefore, the solution to this problem is that Chattr-AI file.txt// cancels the hidden permissions of files, and RM-RF file.txt// deletes files.

The fourth question

Here, use Create User to use the useradd command.

That is, the user adds Tony.

? useradd? Timing (short for timing)

? useradd? sanctuary

Changing the password can be done using the

Passwd user name, but I suggest it is more recommended.

Echo' password' | passwd-stdinuuusername like this?

The answer to this question is echo' red hat' | passwd-stdin Tony.

echo 'redhat' | passwd - stdin tim

echo 'redhat' | passwd - stdin lee

The fifth question

Use the groupadd command to create a group.

So the solution is

Groupadd planning department

The joining group is usermod -g g g.

Usage is sermod -g group name user name.

#-g followed by the group name must be one of the existing groups. Change the user's initialization user group id to correspond to the content in the fourth column of /etc/passwd.

usermod -g? Planning department Tony

Usermod -g strategy department tim

The sixth question

This topic involves disk partition, and there must be many students who have a headache and encounter difficulties. Smile and give it to Orie! ! !

Of course, the first step is to add a disk and use the lsblk command after the successful addition.

Lsblk // Lists all block devices in a tree format.

Then I started zoning.

Press w to save and exit.

Then use the lsblk command, the topic says that the hard disk needs to be formatted as ext4 file system.

So we use the mkfs.ext4 disk path to format the disk as ext4. (as shown in the figure below)

Because it needs to be mounted automatically at startup, you must write /etc/fstab.

Format: mount device path mount point file system default value 0 0

Then mount -a //mount -a will automatically mount the unmounted devices in the /etc/fstab file, regardless of the mounted devices.

Finally, df -Th checks whether it is mounted.

Question 7

Create file 1 touch file 1+0 to set the group to which you belong.

Chgrp cehuabu file 1 or chown :cehuabu file 1.

And setting a user's permissions naturally requires acl.

General usage setfacl -m u: user name: permission file 1.

So the answer to this question is: setfacl-mu: Tony: rwxfile1setfacl-mu: Tim: r-file1

The eighth question

This topic relates to NTP.

yum install-y chronydvim/etc/chrony . conf

Note that all servers 0 1 2 3 are marked with #.

Then add a line of server server.group8.example.com iBurst below.

Save and exit, then restart the service, adding startup and self-startup.

System restart time system startup time

Then use chronyc sources -v to see if it is successful.

Question 9

Write a play. The script starts with #! /bin/bash

Planning task format: time, day, month, week/bin/echo The answer to the question "Hello World" is shown below.

Question 10

You need to enter the directory CD/usr/share/doc/firewall d-0.3.9/

Then copy and use it to the cp command CP-a copy/rootcd/root.

Rename word.txt for mv copy.

Finally, use the sed command sed-i s/license/exam/g/root/word.txt instead.

Question 1 1

(PS; There is no environment for this problem, and it is impossible to reproduce the topic environment at that time, so there may be some deviations in production. ) first of all, lsblk

Create a physical volume, use the pvcreate command pvcreate /dev/sdc, and then use the vgextend command to extend the primary volume group.

Question 12

First, I executed the sar command.

I found that there is no such command, so I need to install this command to query the rpm package that needs to be installed.

Yum whatprovides sar or rpm -qf qf`which sar?

Then use yum install-ysystat.x86 _ 64

Success, and then need to import into /root/ 12.txt, so use SAR >;; /root/ 12.txt

postscript

At this point, the research on the rematch of the Red Hat linux Challenge has been completed, and I will bring you the final question later. Everyone here must want to learn Linux well, so please work hard with a knowledge-seeking heart. Due to the limited level, there must be some shortcomings in many places. If there are any mistakes or mistakes, please correct them and improve them. It is not easy to write this article. Your comments and favorable comments are my greatest motivation. Thank you for your support!