Auditd Linux Tutorial


What is Auditd?

Auditd is the userspace component to the Linux Auditing System. Auditd is short for Linux Audit Daemon. In Linux, daemon is referred to as background running service and there is a ‘d’ attached at the end of the application service as it runs in the background. The job of auditd is to collect and write log files of audit to the disk as a background service

Why use auditd?

This Linux service provides the user a security auditing aspect in Linux. The logs that are collected and saved by auditd, are different activities performed in the Linux environment by the user and if there is a case where any user wants to enquire what other users have been doing in corporate or multiple-user environment, that user can gain access to this kind of information in a simplified and minimized form, which are known as logs. Also, if there has been an unusual activity on a user’s system, let’s say his system was compromised, then the user can track back and see how its system was compromised and this can also help in many cases for incident responding.

Basics of auditd

The user can search through the saved logs by auditd using ausearch and aureport utilities. The audit rules are in the directory, /etc/audit/audit.rules which can be read by auditctl on startup. Also, these rules can also be modified using auditctl. There is auditd configuration file available at /etc/audit/auditd.conf.


In debian-based Linux distributions, following command can be used to install auditd, if not already installed:

ubuntu@ubuntu:~$ sudo apt-get install auditd audispd-plugins

Basic command for auditd:

For starting auditd:

$ service auditd start

For stopping auditd:

$ service auditd stop

For restarting auditd:

$ service auditd restart

For fetching auditd status:

$ service auditd status

For conditional restarting auditd:

$ service auditd condrestart

For reload auditd service:

$ service auditd reload

For rotating auditd logs:

$ service auditd rotate

For checking auditd configurations output:

$ chkconfig –list auditd

What information can be recorded in logs?

  • Timestamp and event information such as type and outcome of an event.
  • Event triggered along with the user who triggered it.
  • Changes to audit configuration files.
  • Access attempts for audit log files.
  • All authentication events with the authenticated users such as ssh, etc.
  • Changes to sensitive files or databases such as passwords in /etc/passwd.
  • Incoming and outgoing information from and to the system.

Other utilities related to audit:

Some other important utilities related to audit are given below. We will only discuss a few of them in detail, which are commonly used.


This utility is used to get behavior status of audit, set, change or update audit configurations. Syntax for auditctl usage is:

auditctl [options]

Following are the options or flag that are mostly used:


To add a watch to a file which means audit will keep an eye on that file and add user activities related to that file to logs.


To input a filter key or name to specified configuration.


To add a filter based upon the permission of files.


To suppress log capturing for a configuration.


To get all the results for the specified input of this option.

For example, to add a watch on /etc/shadow file with filtered keyword ‘shadow-key’ and with permissions as ‘rwxa’:

$ auditctl -w /etc/shadow -k shadow-file -p rwxa


This utility is used for generating audit log summary reports from the recorded logs. The report input can also be raw logs data that is fed to aureport using stdin. Basic syntax for aureport usage is:

aureport [options]

Some of the basic and most commonly used aureport options are as under:


To generate a report based upon the keys specified in the audit rules or configurations.


To display textual information rather than numerical information like id, such as displaying username instead of userid.


To generate report of the authentication attempts for all users.


To generate report displaying the login information of the users.


This utility is searching tool for audit logs or events. The search results are displayed in return, based upon different search queries. Like aureport, these search queries can also be raw logs data that is fed to ausearch using stdin. By default, ausearch queries the logs placed at /var/log/audit/audit.log, which can be directly displayed or accessed as typing command as below:

$ cat /var/log/audit/audit.log

The simple syntax for using ausearch is:

ausearch [options]

Also, there are certain flags that can be used with ausearch command, some commonly used flags are:


This flag is used to input process IDs to search queries for logs, e.g., ausearch -p 6171.


This flag is used to search for specific strings in log files, e.g., ausearch -m USER_LOGIN.


This option is success values if the user is querying success value for specific part of logs. This flag is often used with -m flag such as ausearch -m USER_LOGIN -sv no.


This option is used to input a username filter for the search query, e.g., ausearch -ua root.


This option is used to input a timestamp filter for the search query, e.g., ausearch -ts yesterday.


This utility is used as a daemon for multiplexing of events.


This utility is used for tracing binaries using audit components.


This utility shows the latest activities recorded in logs.


This utility shows the latest login information of all the users or a given user.


This utility allows the mapping of system call names and numbers.


This utility shows the audit information specifically for the virtual machines.


Although Linux Auditing is a relatively advanced topic for non-technical Linux users but letting the users decide for themselves, is what Linux offers. Unlike other operating systems, Linux operating systems tend to keep their users in control of their own environment. Also being a novice or non-technical user, one should always be learning for one’s own growth. Hope this article helped you in learning something new and useful.

Sandclock IDC thành lập vào năm 2012, là công ty chuyên nghiệp tại Việt Nam trong lĩnh vực cung cấp dịch vụ Hosting, VPS, máy chủ vật lý, dịch vụ Firewall Anti DDoS, SSL… Với 10 năm xây dựng và phát triển, ứng dụng nhiều công nghệ hiện đại, Sandclock IDC đã giúp hàng ngàn khách hàng tin tưởng lựa chọn, mang lại sự ổn định tuyệt đối cho website của khách hàng để thúc đẩy việc kinh doanh đạt được hiệu quả và thành công.
Bài viết liên quan

Managing sudo privileges on Linux

sudo is a command which grants superuser privileges to non root users. Using sudo is a practice for safety purposes, by...

Password Safe 3.42.1 released- A Simple and Secure Password Management App

Password Safe 3.42.1 recently released, is an open source, free simple and secure password management app. You can create...

Importance of software updates

In this article, I am discussing the importance of software updates in your server or with web applications. We all know...
Bài Viết

Bài Viết Mới Cập Nhật

Hướng dẫn chuyển đổi windows server windows evaluation to standard và active windows server 2008 + 2012 + 2016 + 2019

How to Update Ubuntu Linux

Squid Proxy Manager cài đặt và quản lý Proxy Squid tự động trên ubuntu

Hướng dẫn cài đặt Apache CloudStack

Hướng dẫn ký file PDF bằng chữ ký số (chữ ký điện tử) và sửa lỗi mới nhất 2021 foxit reader