How to disable AppArmor in Ubuntu

In Linux, AppArmor is a user-friendly and effective Mandatory Access Control (MAC) security module that helps with program restrictions to a limited set of profiles. It was an alternative to SELinux which was hard to maintain and managed by system administrators. AppArmor locks the processes that can potentially harm the system or it can be used by the developers to limit the process’s operations.

AppArmor was developed by using the Linux Security Modules (LSM) and keeping the user requirements in mind. In this guideline, we will explore how to turn off AppArmor in Ubuntu 22.04.

How to disable AppArmor in Ubuntu 22.04

If you want to disable a single process followed by AppArmor or want to disable it completely, both processes are mentioned below.

AppAmor is installed and enabled by default whenever you install the latest Ubuntu system on your machine.

Check AppArmor Status

Refresh all the Ubuntu repositories to the updated versions by using the following command in the terminal:

sudo apt update && sudo apt upgrade

Before removing this from the system, let’s confirm its status. Run the given command in the terminal to execute this task:

systemctl status apparmor

Check AppArmor Profile Loaded

Also, check the current AppArmor profile status on the Ubuntu system before performing any changes. Do this by the mentioned command:

List All AppArmor Profiles

List down the names of processes by navigating to the /etc/apparmor.d path using the command:

Now, run the ls command to display profiles:

How to Disable an AppArmor for a Single Process in Ubuntu 22.04

To disable the AppArmor for a single process or profile (the list is mentioned in the above screenshot), use the following syntax:

$ sudo ln -s /etc/apparmor.d/<profile_name> /etc/apparmor.d/disable/

$ apparmor_parser -R /etc/apparmor.d/disable/<profile_name>

Replace the <profile_name> with the process/profile you want to disable; for example, to disable the /usr.lib.snapd.snap-confine.real profile, the command would be:

$ sudo ln -s /etc/apparmor.d/usr.lib.snapd.snap-confine.real /etc/apparmor.d/disable/

$ apparmor_parser -R /etc/apparmor.d/disable/usr.lib.snapd.snap-confine.real

How to Disable AppArmor Completely in Ubuntu 22.04

If you want to disable the AppArmor service completely, run the given command:

sudo systemctl disable apparmor

Reboot the system to make changes successfully.

Bonus Tip:

How to enable AppArmour Again on Ubuntu 22.04

If you want to enable AppArmor on an Ubuntu machine again, the following steps are required to follow.

Step 1: Start the AppArmor in the terminal by running the command:

sudo systemctl start apparmor

Step 2: Execute the following command to enable the AppArmor by default whenever the system restarts:

sudo systemctl enable apparmor

Step 3: Check the AppArmor status through the mentioned command:

systemctl status apparmor

If you still find it disable, run the following commands individually:

sudo systemctl restart apparmor

sudo systemctl reload apparmor

Once you have done with this command, reboot the system using the given command:

Conclusion

AppArmor is a user-friendly MAC security program that locks the processes that can potentially harm the system or it can be used by the developers to limit the process’s operations. It was developed by using the Linux Security Modules by keeping user requirements in mind. This tutorial has mentioned the way to disable the AppArmour in Ubuntu 22.04. Moreover, we have also discussed the process to enable it again.

source

Leave a Comment