Objective: Check that SELinux is installed and enforcing, and change its mode. Read the labels SELinux puts on files, processes and ports, find a denial in the audit log, and fix it the right way: by fixing the label, setting a boolean, or adding a port to the policy.
In Lab 6 and Lab 15 you controlled access with owners, groups, permissions and ACLs. Those are all discretionary access control (DAC): the owner of a file decides who can use it, and root can do anything. SELinux (Security-Enhanced Linux) adds a second check, mandatory access control (MAC). A system-wide policy decides what each program may do, and not even the owner, or root, can change it with chmod.
| Check | Who decides | Based on | You used it in |
|---|---|---|---|
| DAC (permissions, ACLs) | The file's owner | User, group, rwx, ACL entries |
Labs 6 and 15 |
| MAC (SELinux) | The SELinux policy | Labels on processes, files and ports | This lab |
Linux checks DAC first. If DAC allows it, SELinux checks too. Both must say yes. SELinux denies anything the policy doesn't allow, so a web server that is broken into still can't read your home directory or open a new port.
Note: This lab is done on your development server, NOT your production server. Connect with SSH from Terminal or PuTTY and log in as your own user.
Warning: Part 5 changes the port SSH listens on. The steps keep port 22 open the whole time, so you shouldn't lose your connection. If you do, use the UTM or VirtualBox console to log in and undo the change. Your production server has no console, which is one more reason this lab stays on development.
This lab uses the web server from Lab 13 and the firewall commands from Lab 14.
Some steps give you every command. Others give you a Goal and ask you to work out the commands yourself. If you get stuck, open the hint. Once you have an answer, or if you are really stuck, open the solution and compare it with your own.
If you get stuck, check the Troubleshooting section at the end of this lab.
The examples in this lab use the username angus and the UTM address 192.168.64.7. Always use your username and address.
SELinux is part of the kernel, but the policy and the tools come in packages. List the installed packages with selinux in their name:
sudo dnf list installed | grep selinux
rpm -qa | grep selinux
libselinux.aarch64 3.6-1.el9 @anaconda
libselinux-utils.aarch64 3.6-1.el9 @anaconda
rpm-plugin-selinux.aarch64 4.16.1.3-34.el9 @anaconda
selinux-policy.noarch 38.1.45-3.el9 @anaconda
selinux-policy-targeted.noarch 38.1.45-3.el9 @anaconda
...
| Command | What it does |
|---|---|
dnf list installed |
Lists every installed package, with its version and where it came from. |
rpm -qa |
Queries all installed packages. Same idea, shorter output. We will learn more about dnf and rpm later in the course. |
Your versions, and x86_64 instead of aarch64, may differ. selinux-policy-targeted is the policy itself. You will see the name targeted again in Part 2.
One command you need in Parts 4 and 5, semanage, is in a package that a minimal install may not have. Install it now. If it is already there, dnf says Nothing to do:
sudo dnf install -y policycoreutils-python-utils
which semanage
In Lab 2 you read a man page when you already knew the command's name. man -k searches the short descriptions of all man pages for a word, so you can find a command you don't know yet. apropos does the same thing:
man -k selinux
apropos enforce
Note: If you see nothing appropriate (example), the database of man page descriptions hasn't been built yet. Build it with
sudo mandb, then try again. It takes a minute. You can ignore warnings about pages it can't parse (example, run with-c, which rebuilds the database from scratch).
sudo mandb
man -k selinux
Now try a search of two words, with and without quotes:
apropos "security context"
apropos security context
Question: Why are the results so different?
With quotes, the shell passes one argument, security context, so apropos looks for the phrase. Without quotes, the shell passes two arguments, and apropos lists every page that matches either word. You saw the shell split words on spaces in Lab 2 with echo "hello world".
Goal: Use the manual to find which command shows the SELinux mode in one word, and which command changes the mode. Then read the man page of the second one and find the two values it accepts.
man -k.man -k enforce
getenforce (8) - get the current mode of SELinux
setenforce (8) - modify the mode SELinux is running in
...
man setenforce
setenforce takes Enforcing or 1, or Permissive or 0. You use both commands in Part 2.
Another way: man -k selinux | grep mode narrows a long list to the lines that mention a mode.
SELinux has three modes:
| Mode | What it does |
|---|---|
| enforcing | The policy is enforced. Anything it doesn't allow is denied and logged. This is the default on Red Hat. |
| permissive | Nothing is denied, but everything the policy would deny is logged. Used for troubleshooting. |
| disabled | No policy is loaded. Nothing is checked or logged. |
Check the current mode. Neither command needs sudo:
getenforce
sestatus
Enforcing
SELinux status: enabled
SELinuxfs mount: /sys/fs/selinux
SELinux root directory: /etc/selinux
Loaded policy name: targeted
Current mode: enforcing
Mode from config file: enforcing
Policy MLS status: enabled
Policy deny_unknown status: allowed
Memory protection checking: actual (secure)
Max kernel policy version: 33
| Line | It means |
|---|---|
Loaded policy name: targeted |
The targeted policy. It confines services, such as sshd and nginx, and mostly leaves logged-in users alone. |
Current mode |
The mode now. getenforce prints only this. |
Mode from config file |
The mode the server will start in after a reboot. |
Note: If
getenforcesays Permissive or Disabled, see the Troubleshooting section before you go on. The rest of this lab needs Enforcing.
setenforce changes the mode right away. It doesn't change the config file, so the change only lasts until the next reboot. This is the same idea as runtime and permanent firewall rules in Lab 14:
sudo setenforce 0
getenforce
sestatus | grep -i mode
Permissive
Current mode: permissive
Mode from config file: enforcing
The two lines now disagree. Put it back:
sudo setenforce 1
getenforce
setenforce can only switch between enforcing and permissive. It can't turn SELinux on or off.
The mode at boot is set in /etc/selinux/config. Older guides use /etc/sysconfig/selinux, which is a link to the same file:
ls -l /etc/sysconfig/selinux
less /etc/selinux/config
Most of the file is # comments. Only two lines are settings:
| Setting | What it does |
|---|---|
SELINUX=enforcing |
The mode at boot: enforcing, permissive or disabled. |
SELINUXTYPE=targeted |
The policy to load. |
To change the mode at boot you would edit SELINUX= with sudo vim and reboot. Leave it on enforcing.
Warning: Don't set
SELINUX=disabled. Files created while SELinux is off get no labels, so turning it back on means relabeling every file on the disk at the next boot, which can take a long time. On RHEL 9,disabledin this file doesn't fully turn SELinux off anyway. If you need SELinux out of the way while you troubleshoot, use permissive.
Goal: With one grep command, print only the two setting lines of /etc/selinux/config, without the comments.
Both settings start with the same word, at the very start of the line. Lab 3 used ^ for "start of the line".
grep ^SELINUX /etc/selinux/config
SELINUX=enforcing
SELINUXTYPE=targeted
^SELINUX matches lines that start with SELINUX. The comments start with #, so they don't match, even where they mention SELINUX=.
Another way: grep -v "^#\|^$" /etc/selinux/config prints every line that is not a comment and not empty. \| means "or", as in Lab 13.
SELinux makes every decision from labels, also called contexts. Every file, process and port has one. In Lab 6 you saw a . at the end of every ls -l permission string. It means the file has an SELinux label. The -Z option shows it:
ls -Z /etc/passwd /etc/ssh/sshd_config
ls -Z /usr/share/nginx/html/
ls -dZ ~
system_u:object_r:passwd_file_t:s0 /etc/passwd
system_u:object_r:etc_t:s0 /etc/ssh/sshd_config
unconfined_u:object_r:httpd_sys_content_t:s0 about.html
unconfined_u:object_r:httpd_sys_content_t:s0 index.html
system_u:object_r:httpd_sys_content_t:s0 index.html.orig
...
unconfined_u:object_r:user_home_dir_t:s0 /home/angus
A label has four parts, separated by ::
| Part | Example | It means |
|---|---|---|
| user | system_u |
The SELinux user. Not the same as your Linux user. |
| role | object_r |
Files always have object_r. |
| type | httpd_sys_content_t |
The part that matters most. Types end in _t. The targeted policy is mostly rules of the form "a process of type X may read files of type Y". |
| level | s0 |
Security level. Not used in this course. |
Processes have labels too. Look at the web server from Lab 13, SSH, and yourself:
ps -eZ | grep "nginx\|sshd"
id -Z
system_u:system_r:httpd_t:s0 1234 ? 00:00:00 nginx
system_u:system_r:httpd_t:s0 1235 ? 00:00:00 nginx
system_u:system_r:sshd_t:s0-s0:c0.c1023 856 ? 00:00:00 sshd
unconfined_u:unconfined_r:unconfined_t:s0-s0:c0.c1023
| Command | What it does |
|---|---|
ps -eZ |
Lists every process, with its label. |
id -Z |
Shows your own label. |
nginx runs as type httpd_t, the type for web servers. The policy lets httpd_t read files labeled httpd_sys_content_t, which is why the pages in your web root work. You are unconfined_t, so the targeted policy leaves you alone.
In Lab 13, a page made in your home directory and moved into the web root could fail with Permission denied. Now you can see why. Make a page in a new directory for this lab, and move it into the web root:
mkdir -p ~/inclass/lab-16
cd ~/inclass/lab-16
echo "<h1>SELinux test</h1>" > selinux.html
ls -Z selinux.html
sudo mv selinux.html /usr/share/nginx/html/
ls -lZ /usr/share/nginx/html/selinux.html
curl -I http://localhost/selinux.html
unconfined_u:object_r:user_home_t:s0 selinux.html
-rw-r--r--. 1 angus angus unconfined_u:object_r:user_home_t:s0 ... /usr/share/nginx/html/selinux.html
HTTP/1.1 403 Forbidden
Look at the permissions. Other can read the file, so DAC allows the nginx user to read it. But mv kept the file's label, user_home_t, and the policy doesn't let httpd_t read files from home directories. SELinux said no.
Tip: When you see Permission denied or 403 and the permissions look right, check the SELinux label with
ls -Z.
Find the reason in the logs. The web server's own log only says Permission denied. SELinux writes its denials to the audit log, /var/log/audit/audit.log, as AVC messages. ausearch searches it:
sudo tail -n 1 /var/log/nginx/error.log
sudo ausearch -m avc -ts recent
... open() "/usr/share/nginx/html/selinux.html" failed (13: Permission denied) ...
----
time->Sat Nov 7 10:15:02 2026
...
type=AVC msg=audit(1794046502.123:412): avc: denied { read } for pid=1235 comm="nginx" name="selinux.html" dev="dm-0" ino=135042 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=file permissive=0
| Part | What it does / means |
|---|---|
-m avc |
Only AVC (access vector cache) messages: SELinux decisions. |
-ts recent |
Only the last 10 minutes. time start. |
denied { read } |
What was refused. |
comm="nginx" |
The program that tried. |
scontext=...httpd_t |
The source: the process's label. |
tcontext=...user_home_t |
The target: the file's label. |
tclass=file |
The kind of target: a file. In Part 5 it is a socket. |
permissive=0 |
Enforcing mode, so it was really blocked. |
The policy knows what label every path should have. restorecon (restore context) puts it back:
sudo restorecon -v /usr/share/nginx/html/selinux.html
curl -I http://localhost/selinux.html
Relabeled /usr/share/nginx/html/selinux.html from unconfined_u:object_r:user_home_t:s0 to unconfined_u:object_r:httpd_sys_content_t:s0
HTTP/1.1 200 OK
Common Pitfall: Don't fix a denial by turning SELinux off. It hides the problem on this server and leaves it waiting on the next one. Fix the label.
Question: In Lab 15 you saw that
mvkeeps a file's group, butcpgives the copy a new one. What do you thinkcpdoes with the SELinux label?
cp creates a new file, which gets the label for the directory it is created in, so a page copied with sudo cp into the web root is labeled httpd_sys_content_t and works. mv moves the same file, label and all. Try it: echo test > copy.html, sudo cp copy.html /usr/share/nginx/html/, ls -Z /usr/share/nginx/html/copy.html.
Goal: Make a second page, permissive.html, and mv it into the web root, so you get a 403 again. Then switch to permissive mode and fetch it again. Find its AVC message, and compare it with the one above. Switch back to enforcing, fetch the page once more, and only then fix the label.
curl.setenforce from Part 2 switches the mode.cd ~/inclass/lab-16
echo "<h1>Permissive test</h1>" > permissive.html
sudo mv permissive.html /usr/share/nginx/html/
curl -I http://localhost/permissive.html
sudo setenforce 0
curl -I http://localhost/permissive.html
sudo ausearch -m avc -ts recent | grep permissive.html
The first curl gets 403 Forbidden, and the second gets 200 OK. The AVC line still says denied, but ends in permissive=1: SELinux logged what it would have denied and let it through.
sudo setenforce 1
curl -I http://localhost/permissive.html
sudo restorecon -v /usr/share/nginx/html/permissive.html
curl -I http://localhost/permissive.html
Back in enforcing mode it is 403 again: permissive mode fixed nothing. restorecon does, and the last curl gets 200 OK.
This is how permissive mode is used for real: switch to it briefly, do the thing that fails, read every AVC message it logs, then switch back and fix each cause.
The targeted policy is not one huge file. It is built from modules, usually one for each service:
sudo semodule -l | wc -l
sudo semodule -l | grep "^ssh\|^apache"
430
apache
ssh
semodule -l lists the modules. It can take a few seconds. There is no nginx module. Nginx runs as httpd_t, the type for every web server, so its rules come from the apache module, named after the Apache web server.
The policy also has booleans: on and off switches, written by the policy authors, for common changes. You turn one on instead of writing your own rules:
getsebool -a | wc -l
getsebool -a | grep httpd
getsebool httpd_enable_homedirs
sudo semanage boolean -l | grep httpd_enable_homedirs
httpd_enable_homedirs --> off
httpd_enable_homedirs (off , off) Allow httpd to enable homedirs
| Command | What it does |
|---|---|
getsebool -a |
Lists all booleans and their values. |
getsebool <name> |
Shows one boolean. |
semanage boolean -l |
Lists booleans with two values, now and at boot, plus a description. |
httpd_enable_homedirs would let a web server read pages in users' home directories. Turn it on, look, and turn it off again:
sudo setsebool httpd_enable_homedirs on
sudo semanage boolean -l | grep httpd_enable_homedirs
sudo setsebool httpd_enable_homedirs off
getsebool httpd_enable_homedirs
httpd_enable_homedirs (on , off) Allow httpd to enable homedirs
httpd_enable_homedirs --> off
The first value changed and the second didn't. Like setenforce, setsebool only lasts until the next reboot. setsebool -P makes it permanent. It is slower, because it rebuilds the policy.
Goal: Later in the course, you might want Nginx to pass requests on to another server. By default the policy doesn't let a web server make its own network connections. Find the boolean that allows it, and its value. Don't change it.
semanage boolean -l say what each boolean does.grep httpd, then to a second grep for network.sudo semanage boolean -l | grep httpd | grep network
httpd_can_network_connect (off , off) Allow httpd to can network connect
httpd_can_network_connect_cobbler (off , off) Allow httpd to can network connect cobbler
httpd_can_network_connect_db (off , off) Allow httpd to can network connect db
...
httpd_can_network_connect is off, now and at boot. To turn it on for good you would run sudo setsebool -P httpd_can_network_connect on.
Ports have labels too. The policy lets sshd_t listen only on ports labeled ssh_port_t:
sudo semanage port -l | grep ssh
ssh_port_t tcp 22
Only port 22. In this part you ask SSH to also listen on port 222, see SELinux block it, and add the port to the policy. You keep port 22 the whole time, so your session stays safe.
Note: Moving SSH off port 22 is common on real servers. It doesn't make SSH more secure, but it cuts down the noise from bots that try port 22 on every address.
In Lab 7 you added a file to /etc/ssh/sshd_config.d/ instead of editing sshd_config. Do the same here:
sudo vim /etc/ssh/sshd_config.d/02-port.conf
Add these two lines, then save with :wq:
Port 22
Port 222
Port can be given more than once. When you set it at all, sshd listens only on the ports you list, so keep Port 22 or you lock out every new connection. Check the file and restart, as in Lab 7:
sudo sshd -t
sudo sshd -T | grep "^port"
sudo systemctl restart sshd
systemctl status sshd
port 22
port 222
● sshd.service - OpenSSH server daemon
Active: active (running) since ...
...
error: Bind to port 222 on 0.0.0.0 failed: Permission denied.
error: Bind to port 222 on :: failed: Permission denied.
Server listening on 0.0.0.0 port 22.
Server listening on :: port 22.
sshd -t found no mistakes, and sshd -T shows both ports. But the status shows Permission denied for port 222. sshd is still running only because port 22 worked. Check what it listens on, with ss from Lab 12:
ss -tln | grep 22
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:22 [::]:*
sudo ausearch -m avc -ts recent | grep sshd
type=AVC msg=audit(1794047110.531:847): avc: denied { name_bind } for pid=16525 comm="sshd" src=222 scontext=system_u:system_r:sshd_t:s0-s0:c0.c1023 tcontext=system_u:object_r:reserved_port_t:s0 tclass=tcp_socket permissive=0
| Part | It means |
|---|---|
denied { name_bind } |
sshd tried to bind, or claim, a port to listen on. |
src=222 |
The port. |
tcontext=...reserved_port_t |
Port 222's label. Ports below 1024 that no service owns are reserved_port_t. |
tclass=tcp_socket |
The target is a TCP socket, not a file. |
Add port 222 to ssh_port_t. This takes a few seconds:
sudo semanage port -a -t ssh_port_t -p tcp 222
sudo semanage port -l | grep ssh
ssh_port_t tcp 222, 22
| Part | What it does |
|---|---|
semanage port |
Manages port labels. |
-a |
Adds a label. -d deletes one. |
-t ssh_port_t |
The type to give the port. |
-p tcp |
The protocol. |
222 |
The port number. |
Unlike setenforce and setsebool, semanage changes are permanent. Restart SSH and check again:
sudo systemctl restart sshd
systemctl status sshd
ss -tln | grep 22
LISTEN 0 128 0.0.0.0:222 0.0.0.0:*
LISTEN 0 128 0.0.0.0:22 0.0.0.0:*
LISTEN 0 128 [::]:222 [::]:*
LISTEN 0 128 [::]:22 [::]:*
No more errors, and sshd listens on both ports. Test it from the server itself. The firewall doesn't apply when the server talks to itself, as you saw in Lab 13. Your dev01 key from Lab 9 logs you in:
ssh -p 222 localhost
echo $SSH_CONNECTION
exit
$SSH_CONNECTION, from Lab 12, ends in 222: the server port of this session.
Goal: Open a new SSH session from your laptop to port 222, and prove with $SSH_CONNECTION that it used 222. Two more things stand in the way. Work out what they are.
1. The firewall. The ssh service only opens port 22. Add 222 permanently, reload, and check:
sudo firewall-cmd --permanent --zone=public --add-port=222/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-ports
success
success
222/tcp
2. VirtualBox only. Open your VM's Settings, Network, Port Forwarding:

Add a rule: name ssh222, protocol TCP, host port 2220, guest port 222. Leave the IP fields blank.
3. Connect from a new window on your laptop:
| Hypervisor | Command or PuTTY setting |
|---|---|
| UTM (Mac) | ssh -p 222 dev01, or ssh -p 222 angus@192.168.64.7. -p on the command line beats the port in your Host dev01 block. |
| VirtualBox (Windows) | PuTTY: load dev01, change Port to 2220, click Open. Or ssh -p 2220 angus@127.0.0.1. |
Then, on the server:
echo $SSH_CONNECTION
192.168.64.1 52114 192.168.64.7 222
On VirtualBox, the last number is still 222: VirtualBox sent your port 2220 to the server's port 222.
You now know how to move SSH, so put it back to port 22 only. Undo each change in the reverse order you made it, so nothing is left open.
Goal: From a session on port 22, make SSH listen on port 22 only, remove port 222 from the SSH port label, close it in the firewall, and, on VirtualBox, delete the ssh222 rule. Prove each step.
sshd, but close it anyway, and work from a port 22 session./etc/ssh/sshd_config.d/.sudo rm /etc/ssh/sshd_config.d/02-port.conf
sudo sshd -t
sudo systemctl restart sshd
ss -tln | grep 22
sudo semanage port -d -t ssh_port_t -p tcp 222
sudo semanage port -l | grep ssh
sudo firewall-cmd --permanent --zone=public --remove-port=222/tcp
sudo firewall-cmd --reload
sudo firewall-cmd --zone=public --list-ports
ss shows only port 22, semanage shows ssh_port_t tcp 22, and --list-ports prints an empty line. On VirtualBox, select the ssh222 rule and click the remove button.
Check from your laptop that your usual connection, dev01, still works.
Add what you have learned to your GitLab repository from Lab 10:
cd ~/git/gitlab/itfdn-140-inclass-$USER
git pull
echo "# SELinux
The following are notes and tips related to **SELinux**, **getenforce**, **setenforce**, **restorecon**, **setsebool** and **semanage**.
" >> selinux-tips.md
cat selinux-tips.md
Goal: Add at least three tips or commands to selinux-tips.md that you would want next time. Add a link to the file at the end of README.md. Commit both files in one commit, and push. In GitLab, click the link in your README and check that it opens your notes.
~/git/gitlab/itfdn-140-inclass-$USER with pwd.vim selinux-tips.md
Add your own tips, then save with :wq. For example:
## Modes
`getenforce`, `sestatus`. `sudo setenforce 0` (permissive) or `1` (enforcing) until reboot. At boot: `/etc/selinux/config`.
## Permission denied but permissions look right
`ls -Z file`, then `sudo ausearch -m avc -ts recent`. Fix a wrong label with `sudo restorecon -v file`.
## Booleans and ports
`getsebool -a | grep name`, `sudo setsebool -P name on`. `sudo semanage port -a -t ssh_port_t -p tcp 222`.
Add the link, then check, commit and push:
echo "" >> README.md
echo "[SELinux](selinux-tips.md)" >> README.md
git status
git diff
git add README.md selinux-tips.md
git commit -m "docs: add SELinux tips and link from README"
git push
git log --oneline
You have now:
man -k and apropos.getenforce and sestatus, and switched between enforcing and permissive.ausearch, and fixed a wrong file label with restorecon.semanage, opened it in the firewall, and put it all back.SELinux is still enforcing, and SSH is back on port 22 only.
setenforce 0 and SELINUX=permissive in /etc/selinux/config?mv get a 403, but a page copied with cp didn't?permissive=1 at the end of an AVC message tell you?setsebool and setsebool -P?Q. getenforce says "Permissive".
A. Run sudo setenforce 1 for now. Then check grep ^SELINUX= /etc/selinux/config. If it says permissive, change it to enforcing with sudo vim, so it stays that way after a reboot.
Q. getenforce says "Disabled".
A. Edit /etc/selinux/config with sudo vim and set SELINUX=enforcing. Then run sudo touch /.autorelabel and sudo reboot. The empty file /.autorelabel tells the server to relabel every file while it boots, which can take several minutes, and the server may reboot once more by itself. Wait, then log in and check with getenforce.
Q. man -k or apropos says "nothing appropriate".
A. Run sudo mandb, then try again. See Part 1.
Q. sudo: semanage: command not found.
A. Install it with sudo dnf install -y policycoreutils-python-utils. Older guides name the package policycoreutils-python, which doesn't exist on RHEL 9.
Q. sudo ausearch -m avc -ts recent says "<no matches>".
A. recent means the last 10 minutes. Repeat the step that failed, then search again, or use -ts today. If there is still nothing, SELinux didn't deny anything, so look at the permissions and the service's own log instead.
Q. My moved page still gets 403 after restorecon.
A. Check the permissions with ls -l. Other needs r on the file, as in Lab 6, because Nginx runs as the nginx user. Then check sudo tail -n 1 /var/log/nginx/error.log.
Q. semanage port -a says "Port tcp/222 already defined".
A. You added it already. Check with sudo semanage port -l | grep ssh. To change the type of a port that is already labeled, use -m (modify) instead of -a.
Q. sshd doesn't listen on port 222, and there is no AVC message.
A. Check the file name and its contents with cat /etc/ssh/sshd_config.d/02-port.conf. The file must end in .conf. Check that sudo sshd -T | grep "^port" shows both ports, and that you restarted sshd.
Q. From my laptop, port 222 says "No route to host" or times out.
A. The firewall is blocking it. Check sudo firewall-cmd --zone=public --list-ports, and that you ran --reload after the --permanent change. On VirtualBox, also check the ssh222 rule, and use host port 2220.
Q. From my laptop, port 222 says "Connection refused".
A. The firewall let you through, but nothing listens on 222. Check ss -tln | grep 22 on the server.
Q. I can't connect with SSH at all.
A. Log in on the UTM or VirtualBox console. Remove the port file with sudo rm /etc/ssh/sshd_config.d/02-port.conf and run sudo systemctl restart sshd. With no Port line, sshd listens on 22 again.
Q. git push is rejected.
A. Your GitLab repository has a change you don't have yet. Run git pull, then git push again, as in Lab 10.
If you can't solve a problem, post it in this week's Teams channel, or reach out by email for help.
Lab complete