Install Lynis on Raspberry Pi

Install Lynis on Raspberry Pi

Lynis is a command line tool that allows to perform security audit, vulnerability detection, system hardening, etc. It scans the system to find configuration mistakes, vulnerable packages, insecure services, wrong filesystem permissions and other security issues.

This tutorial shows how to install Lynis on Raspberry Pi.

Install Lynis

Connect to Raspberry Pi via SSH and download GPG key:

sudo wget -qO /etc/apt/trusted.gpg.d/cisofy-key.asc

Run the following command to configure APT package manager to skip downloading translations:

echo 'Acquire::Languages "none";' | sudo tee /etc/apt/apt.conf.d/99disable-translations

Add the Lynis repository:

echo "deb stable main" | sudo tee /etc/apt/sources.list.d/cisofy-lynis.list

Update the package lists:

sudo apt update

Install Lynis:

sudo apt install -y lynis

Once installation is finished, we can check version of Lynis:

sudo lynis --version

Testing Lynis

To perform security audit, run the lynis command as follows:

sudo lynis audit system

An example of audit report:


[+] Boot and services
  - Service Manager                                           [ systemd ]
  - Checking UEFI boot                                        [ DISABLED ]
    - Boot loader                                             [ NONE FOUND ]
  - Check running services (systemctl)                        [ DONE ]
        Result: found 17 running services

[+] File systems
  - Checking mount points
    - Checking /home mount point                              [ SUGGESTION ]
    - Checking /tmp mount point                               [ SUGGESTION ]
    - Checking /var mount point                               [ SUGGESTION ]

Uninstall Lynis

If you decided to completely remove Lynis, run the following command:

sudo apt purge --autoremove -y lynis

Remove GPG key, repository and APT config file:

sudo rm -rf /etc/apt/trusted.gpg.d/cisofy-key.asc
sudo rm -rf /etc/apt/sources.list.d/cisofy-lynis.list
sudo rm -rf /etc/apt/apt.conf.d/99disable-translations

Remove logs:

sudo rm -rf /var/log/lynis*

Leave a Comment

Cancel reply

Your email address will not be published.