هذا الجزء لم يُترجم بعد. أنت ترى النص الإنجليزي.
الهدف
A new colleague needs a ready server. Do all tasks on server1 without looking at the summaries. Use only man, --help and /usr/share/doc. Then reboot and check that everything still works.
قبل أن تبدأ
- server1 and server2 with RHEL 10 (or CentOS Stream 10 / AlmaLinux 10) on the network
192.168.122.0/24, gateway and DNS192.168.122.1; server2 has192.168.122.20. - Work as
student(member ofwheel) on the console of server1. Usesudofor root tasks. - A repository for software must work (registered system, or the DVD as a local repository).
المهام
ضع علامة على المهمة عندما تنتهي منها. متصفحك فقط يتذكر ذلك.
- Network: give the active profile of server1 the fixed address
192.168.122.10/24, gateway and DNS192.168.122.1. Set the host nameserver1.example.com. Makeserver2andserver2.example.comwork by name without DNS. - Users: create the group
devopswith GID4000. Create the usersmiaandleowithdevopsas extra group, and the userguestwith no login shell. All three get the passwordRedHat-2026. - Passwords:
miaandleomust change their password every 60 days and get a warning 5 days before.guestmust expire on2026-12-31. - sudo: members of
devopsmay runsystemctlandjournalctlas root — nothing else. - Shared folder: make
/srv/devops. Members ofdevopsmay create and change files there, new files get the groupdevops, users can not delete files of others, other users have no access at all. - Software and service: install the web server
httpd. Put the textserver1 worksinto/var/www/html/index.html. The service must run now and after every reboot. Open the firewall forhttppermanently. - Process: as
leo, startsleep 3000in the background. Asstudent, find the PID and stop it with SIGTERM. - SSH: as
studenton server1, make an ed25519 key and log in tostudent@server2without a password. On server1, root must not log in over SSH any more. - Report: write the output of
ip -br a,ss -tlnandsystemctl is-enabled httpdinto/root/report.txt; errors must go into/root/report.err. - Reboot server1 and check all tasks again.
تحقّق من عملك
hostnamectl --static
ip -br -4 a
getent hosts server2
id mia ; id leo ; getent passwd guest
sudo chage -l mia | grep -E 'Maximum|warning'
sudo chage -l guest | grep 'Account expires'
sudo -l -U mia
ls -ld /srv/devops
curl -s http://localhost/
systemctl is-active httpd ; systemctl is-enabled httpd
sudo firewall-cmd --list-services
ssh student@server2 hostname
sudo sshd -T | grep -i permitrootlogin
sudo cat /root/report.txtls -ld /srv/devopsshowsdrwxrws--Tand the groupdevops.curlprintsserver1 works, httpd isactiveandenabled, the firewall listshttp.ssh student@server2 hostnameprints the name without asking for a password.sshd -Tshowspermitrootlogin no.
تلميحات
اعرض التلميحات
nmcli con showshows the profile name; the new address works afternmcli con up.useradd -s /sbin/nologinmakes a user that can not log in.echo 'USER:PASSWORD' | chpasswdsets a password in one line.- For sudo, use full paths:
which systemctl journalctl. 3770= SGID + sticky +rwxfor owner and group.- Put your sshd setting into a drop-in file;
sshd -tchecks the syntax. { cmd1; cmd2; } > file 2> file.errsends the output of several commands at once.
الحل
اعرض الحل
- Network.
- Users and group.
- Password rules.
- sudo rule (check the syntax before you leave visudo).
- Shared folder.
- Web server.
- Find and stop the process (start it as leo in a second terminal:
su - leo, thensleep 3000 &). - SSH key and root login.
ssh-keygen -t ed25519 ssh-copy-id student@server2 ssh student@server2 hostname echo "PermitRootLogin no" | sudo tee /etc/ssh/sshd_config.d/50-noroot.conf sudo sshd -t sudo systemctl reload sshd - The report.
- Reboot and run the checks above again.
ملاحظاتي
لا توجد ملاحظات بعد.
دروس هذا المعمل
- 18.2Set a fixed IPv4 address
- 18.8Set the host name
- 18.9Make names work without DNS
- 10.5Create, change and delete users
- 10.4Give admin rights with sudo
- 10.7Set password rules
- 11.8Build a shared team folder
- 12.3Install, update and remove
- 16.4Enable a service at boot
- 15.6Stop processes with signals
- 19.4Log in with the key
- 19.7Secure the SSH server
- 9.3Handle error messages