ServerHandbook live check: run log ------------------------------------------------------------------------------ Article https://serverhandbook.com/kb/create-sudo-user-ubuntu Check scripts/live/checks/create-sudo-user-ubuntu.mjs (sha256 5ca32bcffed0f0dd787716b840f7d38e3ca8630509747bda37a61c0e3126a85d) Ran at 2026-11-15T14:40:13Z (218 s) Result PASS, all 27 claims held Tested on System Ubuntu 24.04.5 LTS Kernel 6.8.0-147-generic Package adduser 3.137ubuntu1 Package passwd 1:4.13+dfsg1-4ubuntu3.2 Package sudo 1.9.15p5-3ubuntu5.24.04.4 Package openssh-server 1:9.6p1-3ubuntu13.20 Setup A fresh Ubuntu 24.04 server as a provider hands it over: root logs in with your SSH key, no other user. Every version above was read from the server at run time. Passwords used on the throwaway test server are shown as [password]. How we test: https://serverhandbook.com/how-we-test ------------------------------------------------------------------------------ What the steps changed on the server (recorded before the first step and after the last) Packages added (0) Packages upgraded (0) Packages removed (0) Services enabled at boot (0) Services disabled (0) Listening sockets opened (0) Listening sockets closed (0) Files added in /etc (6) /etc/group- /etc/gshadow- /etc/passwd- /etc/shadow- /etc/subgid- /etc/subuid- Files changed in /etc (6) /etc/group /etc/gshadow /etc/passwd /etc/shadow /etc/subgid /etc/subuid Files removed from /etc (0) Disk used on / (includes logs written during the run): +8.1 MB ------------------------------------------------------------------------------ ------------------------------------------------------------------------------ Audit: Lynis 3.1.7, the whole server, before the first step and after the last ------------------------------------------------------------------------------ Hardening index 62 -> 62 (Lynis's own score for this server; not a certification) Warnings 2 -> 2 Suggestions 40 -> 41 Resolved by the steps (0) New after the steps (1) AUTH-9282 When possible set expire dates for all password protected accounts ------------------------------------------------------------------------------ Claims (27), each with what the run saw ------------------------------------------------------------------------------ 1. ok a bare Ubuntu 24.04 server box (web-server) starts 2. ok the provider logs you in as root, and there is no deploy user yet | root | id: ‘deploy’: no such user 3. ok adduser creates the user and sets the password (24.04 also prints each step it takes) | info: Adding user `deploy' ... | info: Selecting UID/GID from range 1000 to 59999 ... | info: Adding new group `deploy' (1000) ... | info: Adding new user `deploy' (1000) with group `deploy (1000)' ... | info: Creating home directory `/home/deploy' ... | info: Copying files from `/etc/skel' ... | New password: | Retype new password: | passwd: password updated successfully | Changing the user information for deploy | Enter the new value, or press ENTER for the default | Full Name []: | Room Number []: | Work Phone []: | Home Phone []: | Other []: | Is the information correct? [Y/n] Y | info: Adding new user `deploy' to supplemental / extra groups `users' ... | info: Adding user `deploy' to group `users' ... 4. ok deploy gets /home/deploy and /bin/bash | deploy:x:1000:1000:,,,:/home/deploy:/bin/bash 5. ok usermod -aG sudo prints nothing and succeeds | 0 6. ok groups deploy now lists sudo | deploy : deploy sudo users 7. ok a login started before usermod still has no sudo group (groups are read at login) | deploy users 8. ok cp + chown copy root’s .ssh folder to deploy and print nothing | 0 9. ok the copy is owned by deploy: .ssh is drwx------ and authorized_keys -rw------- | total 12 | drwx------ 2 deploy deploy 4096 Nov 15 14:42 . | drwxr-x--- 3 deploy deploy 4096 Nov 15 14:42 .. | -rw------- 1 deploy deploy 108 Nov 15 14:42 authorized_keys 10. ok the key logs in as deploy, and the new login has the sudo group | To run a command as administrator (user "root"), use "sudo ". | See "man sudo_root" for details. | | deploy | deploy sudo users 11. ok sudo asks for deploy’s own password, then runs as root | To run a command as administrator (user "root"), use "sudo ". | See "man sudo_root" for details. | | [sudo] password for deploy: | root 12. ok sudo --version: the classic sudo ("Sudo version 1.9…") | Sudo version 1.9.15p5 | Sudoers policy plugin version 1.9.15p5 | Sudoers file grammar version 50 | Sudoers I/O plugin version 1.9.15p5 | Sudoers audit plugin version 1.9.15p5 13. ok sudo -l shows (ALL : ALL) ALL for deploy | [sudo] password for deploy: | Matching Defaults entries for deploy on web-server: | env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, | use_pty | | User deploy may run the following commands on web-server: | (ALL : ALL) ALL 14. ok /etc/sudoers gives the sudo group (ALL:ALL) ALL | [sudo] password for deploy: | 53:%sudo ALL=(ALL:ALL) ALL 15. ok useradd sets no password: passwd -S shows L (locked) | spare L 2026-11-15 0 99999 7 -1 16. ok useradd with no options gives /bin/sh and makes no home folder | spare:x:1001:1001::/home/spare:/bin/sh | ls: cannot access '/home/spare': No such file or directory 17. ok the spare user is in adm | spare : spare adm 18. ok usermod -G sudo WITHOUT -a drops adm: the list is replaced, not added to | spare : spare sudo 19. ok userdel removes the spare user | id: ‘spare’: no such user 20. ok deluser deploy sudo removes deploy from the group | info: Removing user `deploy' from group `sudo' ... | id -nG: deploy users 21. ok a new login is then refused by sudo | [sudo] password for deploy: | deploy is not in the sudoers file. 22. ok no mail program on a fresh server, so sudo prints no "This incident has been reported" line | ls: cannot access '/usr/sbin/sendmail': No such file or directory 23. ok (tested on) the box reports its OS, kernel and the version of 4 package(s) | PRETTY_NAME="Ubuntu 24.04.5 LTS" | VIRT=none | KERNEL=6.8.0-147-generic | PKG adduser 3.137ubuntu1 | PKG openssh-server 1:9.6p1-3ubuntu13.20 | PKG passwd 1:4.13+dfsg1-4ubuntu3.2 | PKG sudo 1.9.15p5-3ubuntu5.24.04.4 24. ok userdel refuses while deploy is still logged in: "currently used by process" | userdel: user deploy is currently used by process 61922 25. ok loginctl terminate-user ends every deploy login and prints nothing | 0 26. ok a few seconds after terminate-user, deploy has no process left | gone after 1 s 27. ok userdel -r removes deploy and /home/deploy | userdel: deploy mail spool (/var/mail/deploy) not found | id: ‘deploy’: no such user | ls: cannot access '/home/deploy': No such file or directory ------------------------------------------------------------------------------ Commands and what they printed (22) ------------------------------------------------------------------------------ $ whoami && id deploy root id: ‘deploy’: no such user $ adduser deploy info: Adding user `deploy' ... info: Selecting UID/GID from range 1000 to 59999 ... info: Adding new group `deploy' (1000) ... info: Adding new user `deploy' (1000) with group `deploy (1000)' ... info: Creating home directory `/home/deploy' ... info: Copying files from `/etc/skel' ... New password: Retype new password: passwd: password updated successfully Changing the user information for deploy Enter the new value, or press ENTER for the default Full Name []: Room Number []: Work Phone []: Home Phone []: Other []: Is the information correct? [Y/n] Y info: Adding new user `deploy' to supplemental / extra groups `users' ... info: Adding user `deploy' to group `users' ... $ getent passwd deploy deploy:x:1000:1000:,,,:/home/deploy:/bin/bash $ usermod -aG sudo deploy $ groups deploy deploy : deploy sudo users $ cp -r ~/.ssh /home/deploy/ && chown -R deploy:deploy /home/deploy/.ssh $ ls -la /home/deploy/.ssh total 12 drwx------ 2 deploy deploy 4096 Nov 15 14:42 . drwxr-x--- 3 deploy deploy 4096 Nov 15 14:42 .. -rw------- 1 deploy deploy 108 Nov 15 14:42 authorized_keys $ whoami && groups To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details. deploy deploy sudo users $ sudo whoami To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details. [sudo] password for deploy: root $ sudo --version Sudo version 1.9.15p5 Sudoers policy plugin version 1.9.15p5 Sudoers file grammar version 50 Sudoers I/O plugin version 1.9.15p5 Sudoers audit plugin version 1.9.15p5 $ sudo -l [sudo] password for deploy: Matching Defaults entries for deploy on web-server: env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin, use_pty User deploy may run the following commands on web-server: (ALL : ALL) ALL $ sudo grep -n "^%sudo" /etc/sudoers [sudo] password for deploy: 53:%sudo ALL=(ALL:ALL) ALL $ useradd spare && getent passwd spare && ls -d /home/spare spare:x:1001:1001::/home/spare:/bin/sh ls: cannot access '/home/spare': No such file or directory $ groups spare spare : spare adm $ usermod -G sudo spare && groups spare spare : spare sudo $ userdel spare && id spare id: ‘spare’: no such user $ deluser deploy sudo info: Removing user `deploy' from group `sudo' ... $ sudo whoami [sudo] password for deploy: deploy is not in the sudoers file. $ ls /usr/sbin/sendmail ls: cannot access '/usr/sbin/sendmail': No such file or directory $ userdel -r deploy userdel: user deploy is currently used by process 61922 $ loginctl terminate-user deploy $ userdel -r deploy; id deploy; ls -d /home/deploy userdel: deploy mail spool (/var/mail/deploy) not found id: ‘deploy’: no such user ls: cannot access '/home/deploy': No such file or directory ------------------------------------------------------------------------------ lynis: its full screen before the first step ------------------------------------------------------------------------------ [ Lynis 3.1.7 ] ################################################################################ Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. See the LICENSE file for details about using this software. 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ################################################################################ [+] Initializing program ------------------------------------ - Detecting OS...  [ DONE ] - Checking profiles... [ DONE ] --------------------------------------------------- Program version: 3.1.7 Operating system: Linux Operating system name: Ubuntu Operating system version: 24.04 End-of-life: NO Kernel version: 6.8.0 Hardware platform: x86_64 Hostname: web-server --------------------------------------------------- Profiles: /tmp/shb-audit/lynis/default.prf Log file: /dev/null Report file: /tmp/shb-audit/report.dat Report version: 1.0 Plugin directory: ./plugins --------------------------------------------------- Auditor: [Not Specified] Language: en Test category: all Test group: all --------------------------------------------------- - Program update status...  [ UNKNOWN ] [+] System tools ------------------------------------ - Scanning available tools... - Checking system binaries... [+] Plugins (phase 1) ------------------------------------ Note: plugins have more extensive tests and may take several minutes to complete   - Plugins enabled [ NONE ] [+] Boot and services ------------------------------------ - Service Manager [ systemd ] - Checking UEFI boot [ DISABLED ] - Checking presence GRUB2 [ FOUND ] - Checking for password protection [ NONE ] - Check running services (systemctl) [ DONE ] Result: found 20 running services - Check enabled services at boot (systemctl) [ DONE ] Result: found 45 enabled services - Check startup files (permissions) [ OK ] - Running 'systemd-analyze security' Unit name (exposure value) and predicate -------------------------------- - ModemManager.service (value=6.3) [ MEDIUM ] - cron.service (value=9.6) [ UNSAFE ] - dbus.service (value=9.5) [ UNSAFE ] - dm-event.service (value=9.5) [ UNSAFE ] - dmesg.service (value=9.6) [ UNSAFE ] - emergency.service (value=9.5) [ UNSAFE ] - getty@tty1.service (value=9.6) [ UNSAFE ] - iscsid.service (value=9.5) [ UNSAFE ] - lvm2-lvmpolld.service (value=9.5) [ UNSAFE ] - multipathd.service (value=9.5) [ UNSAFE ] - networkd-dispatcher.service (value=9.6) [ UNSAFE ] - open-vm-tools.service (value=9.5) [ UNSAFE ] - plymouth-start.service (value=9.5) [ UNSAFE ] - polkit.service (value=1.6) [ PROTECTED ] - rc-local.service (value=9.6) [ UNSAFE ] - rescue.service (value=9.5) [ UNSAFE ] - rsyslog.service (value=6.3) [ MEDIUM ] - serial-getty@ttyS0.service (value=9.6) [ UNSAFE ] - snapd.service (value=9.9) [ UNSAFE ] - ssh.service (value=9.6) [ UNSAFE ] - systemd-ask-password-console.service (value=9.4) [ UNSAFE ] - systemd-ask-password-plymouth.service (value=9.5) [ UNSAFE ] - systemd-ask-password-wall.service (value=9.4) [ UNSAFE ] - systemd-bsod.service (value=9.5) [ UNSAFE ] - systemd-fsckd.service (value=9.5) [ UNSAFE ] - systemd-initctl.service (value=9.4) [ UNSAFE ] - systemd-journald.service (value=4.3) [ PROTECTED ] - systemd-logind.service (value=2.8) [ PROTECTED ] - systemd-networkd.service (value=2.6) [ PROTECTED ] - systemd-resolved.service (value=2.2) [ PROTECTED ] - systemd-rfkill.service (value=9.4) [ UNSAFE ] - systemd-timedated.service (value=2.2) [ PROTECTED ] - systemd-timesyncd.service (value=2.1) [ PROTECTED ] - systemd-udevd.service (value=7.1) [ MEDIUM ] - tpm-udev.service (value=9.6) [ UNSAFE ] - ubuntu-advantage.service (value=9.6) [ UNSAFE ] - udisks2.service (value=9.6) [ UNSAFE ] - unattended-upgrades.service (value=9.6) [ UNSAFE ] - user@0.service (value=9.8) [ UNSAFE ] - uuidd.service (value=5.8) [ MEDIUM ] - vgauth.service (value=9.5) [ UNSAFE ] [+] Kernel ------------------------------------ - Checking default runlevel [ runlevel 5 ] - Checking CPU support (NX/PAE) CPU support: PAE and/or NoeXecute supported [ FOUND ] - Checking kernel version and release [ DONE ] - Checking kernel type [ DONE ] - Checking loaded kernel modules [ DONE ] Found 52 active modules - Checking Linux kernel configuration file [ FOUND ] - Checking default I/O kernel scheduler [ NOT FOUND ] - Checking for available kernel update [ OK ] - Checking core dumps configuration - configuration in systemd conf files [ DEFAULT ] - configuration in /etc/profile [ DEFAULT ] - 'hard' configuration in /etc/security/limits.conf [ DEFAULT ] - 'soft' configuration in /etc/security/limits.conf [ DEFAULT ] - Checking setuid core dumps configuration [ PROTECTED ] - Check if reboot is needed [ NO ] [+] Memory and Processes ------------------------------------ - Checking /proc/meminfo [ FOUND ] - Searching for dead/zombie processes [ NOT FOUND ] - Searching for IO waiting processes [ NOT FOUND ] - Search prelink tooling [ NOT FOUND ] [+] Users, Groups and Authentication ------------------------------------ - Administrator accounts [ OK ] - Unique UIDs [ OK ] - Consistency of group files (grpck) [ OK ] - Unique group IDs [ OK ] - Unique group names [ OK ] - Password file consistency [ OK ] - Password hashing methods [ OK ] - Checking password hashing rounds [ DISABLED ] - Query system users (non daemons) [ DONE ] - NIS+ authentication support [ NOT ENABLED ] - NIS authentication support [ NOT ENABLED ] - Sudoers file(s) [ FOUND ] - Permissions for directory: /etc/sudoers.d [ WARNING ] - Permissions for: /etc/sudoers [ OK ] - Permissions for: /etc/sudoers.d/README [ OK ] - PAM password strength tools [ SUGGESTION ] - PAM configuration files (pam.conf) [ FOUND ] - PAM configuration files (pam.d) [ FOUND ] - PAM modules [ FOUND ] - LDAP module in PAM [ NOT FOUND ] - Accounts without expire date [ OK ] - Accounts without password [ OK ] - Locked accounts [ OK ] - Checking user password aging (minimum) [ DISABLED ] - User password aging (maximum) [ DISABLED ] - Checking expired passwords [ OK ] - Checking Linux single user mode authentication [ OK ] - Determining default umask - umask (/etc/profile) [ NOT FOUND ] - umask (/etc/login.defs) [ SUGGESTION ] - LDAP authentication support [ NOT ENABLED ] - Logging failed login attempts [ ENABLED ] [+] Kerberos ------------------------------------ - Check for Kerberos KDC and principals [ NOT FOUND ] [+] Shells ------------------------------------ - Checking shells from /etc/shells Result: found 9 shells (valid shells: 9). - Session timeout settings/tools [ NONE ] - Checking default umask values - Checking default umask in /etc/bash.bashrc [ NONE ] - Checking default umask in /etc/profile [ NONE ] [+] File systems ------------------------------------ - Checking mount points - Checking /home mount point [ SUGGESTION ] - Checking /tmp mount point [ SUGGESTION ] - Checking /var mount point [ SUGGESTION ] - Query swap partitions (fstab) [ NONE ] - Testing swap partitions [ OK ] - Testing /proc mount (hidepid) [ SUGGESTION ] - Checking for old files in /tmp [ OK ] - Checking /tmp sticky bit [ OK ] - Checking /var/tmp sticky bit [ OK ] - ACL support root file system [ ENABLED ] - Mount options of / [ NON DEFAULT ] - Mount options of /boot [ DEFAULT ] - Mount options of /dev [ PARTIALLY HARDENED ] - Mount options of /dev/shm [ PARTIALLY HARDENED ] - Mount options of /run [ HARDENED ] - Total without nodev:6 noexec:8 nosuid:4 ro or noexec (W^X): 8 of total 23 - Disable kernel support of some filesystems [+] USB Devices ------------------------------------ - Checking usb-storage driver (modprobe config) [ NOT DISABLED ] - Checking USB devices authorization [ DISABLED ] - Checking USBGuard [ NOT FOUND ] [+] Storage ------------------------------------ - Checking firewire ohci driver (modprobe config) [ DISABLED ] [+] NFS ------------------------------------ - Check running NFS daemon [ NOT FOUND ] [+] Name services ------------------------------------ - Checking search domains [ FOUND ] - Checking /etc/resolv.conf options [ FOUND ] - Searching DNS domain name [ UNKNOWN ] - Checking /etc/hosts - Duplicate entries in hosts file [ NONE ] - Presence of configured hostname in /etc/hosts [ FOUND ] - Hostname mapped to localhost [ NOT FOUND ] - Localhost mapping to IP address [ OK ] [+] Ports and packages ------------------------------------ - Searching package managers - Searching dpkg package manager [ FOUND ] - Querying package manager - Query unpurged packages [ NONE ] - Checking security repository in sources.list.d directory [ OK ] - Checking APT package database [ OK ] - Checking vulnerable packages [ WARNING ] [WARNING]: Test PKGS-7392 had a long execution: 85.211457 seconds - Checking upgradeable packages [ SKIPPED ] - Checking package audit tool [ INSTALLED ] Found: apt-get - Toolkit for automatic upgrades (unattended-upgrade) [ FOUND ] [+] Networking ------------------------------------ - Checking IPv6 configuration [ ENABLED ] Configuration method [ AUTO ] IPv6 only [ NO ] - Checking configured nameservers - Testing nameservers Nameserver: 127.0.0.53 [ OK ] - DNSSEC supported (systemd-resolved) [ UNKNOWN ] - Getting listening ports (TCP/UDP) [ DONE ] - Checking promiscuous interfaces [ OK ] - Checking status DHCP client [ NOT ACTIVE ] - Checking for ARP monitoring software [ NOT FOUND ] - Uncommon network protocols [ 0 ] [+] Printers and Spools ------------------------------------ - Checking cups daemon [ NOT FOUND ] - Checking lp daemon [ NOT RUNNING ] [+] Software: e-mail and messaging ------------------------------------ [+] Software: firewalls ------------------------------------ - Checking iptables kernel module [ FOUND ] - Checking iptables policies of chains [ FOUND ] - Chain INPUT (table: filter, target: ACCEPT) [ ACCEPT ] - Chain INPUT (table: security, target: ACCEPT) [ ACCEPT ] - Checking for empty ruleset [ WARNING ] - Checking for unused rules [ OK ] - Checking host based firewall [ ACTIVE ] [+] Software: webserver ------------------------------------ - Checking Apache [ NOT FOUND ] - Checking nginx [ NOT FOUND ] [+] SSH Support ------------------------------------ - Checking running SSH daemon [ FOUND ] - Searching SSH configuration [ FOUND ] - OpenSSH option: AllowTcpForwarding [ SUGGESTION ] - OpenSSH option: ClientAliveCountMax [ SUGGESTION ] - OpenSSH option: ClientAliveInterval [ OK ] - OpenSSH option: FingerprintHash [ OK ] - OpenSSH option: GatewayPorts [ OK ] - OpenSSH option: IgnoreRhosts [ OK ] - OpenSSH option: LoginGraceTime [ OK ] - OpenSSH option: LogLevel [ SUGGESTION ] - OpenSSH option: MaxAuthTries [ SUGGESTION ] - OpenSSH option: MaxSessions [ SUGGESTION ] - OpenSSH option: PermitRootLogin [ OK ] - OpenSSH option: PermitUserEnvironment [ OK ] - OpenSSH option: PermitTunnel [ OK ] - OpenSSH option: Port [ SUGGESTION ] - OpenSSH option: PrintLastLog [ OK ] - OpenSSH option: StrictModes [ OK ] - OpenSSH option: TCPKeepAlive [ SUGGESTION ] - OpenSSH option: UseDNS [ OK ] - OpenSSH option: X11Forwarding [ SUGGESTION ] - OpenSSH option: AllowAgentForwarding [ SUGGESTION ] - OpenSSH option: AllowUsers [ NOT FOUND ] - OpenSSH option: AllowGroups [ NOT FOUND ] [+] SNMP Support ------------------------------------ - Checking running SNMP daemon [ NOT FOUND ] [+] Databases ------------------------------------ No database engines found [+] LDAP Services ------------------------------------ - Checking OpenLDAP instance [ NOT FOUND ] [+] PHP ------------------------------------ - Checking PHP [ NOT FOUND ] [+] Squid Support ------------------------------------ - Checking running Squid daemon [ NOT FOUND ] [+] Logging and files ------------------------------------ - Checking for a running log daemon [ OK ] - Checking Syslog-NG status [ NOT FOUND ] - Checking systemd journal status [ FOUND ] - Checking Metalog status [ NOT FOUND ] - Checking RSyslog status [ FOUND ] - Checking RFC 3195 daemon status [ NOT FOUND ] - Checking minilogd instances [ NOT FOUND ] - Checking wazuh-agent daemon status [ NOT FOUND ] - Checking logrotate presence [ OK ] - Checking remote logging [ NOT ENABLED ] - Checking log directories (static list) [ DONE ] - Checking open log files [ DONE ] - Checking deleted files in use [ DONE ] [+] Insecure services ------------------------------------ - Installed inetd package [ NOT FOUND ] - Installed xinetd package [ OK ] - xinetd status [ NOT ACTIVE ] - Installed rsh client package [ OK ] - Installed rsh server package [ OK ] - Installed telnet client package [ OK ] - Installed telnet server package [ NOT FOUND ] - Checking NIS client installation [ OK ] - Checking NIS server installation [ OK ] - Checking TFTP client installation [ OK ] - Checking TFTP server installation [ OK ] [+] Banners and identification ------------------------------------ - /etc/issue [ FOUND ] - /etc/issue contents [ WEAK ] - /etc/issue.net [ FOUND ] - /etc/issue.net contents [ WEAK ] [+] Scheduled tasks ------------------------------------ - Checking crontab and cronjob files [ DONE ] [+] Accounting ------------------------------------ - Checking accounting information [ NOT FOUND ] - Checking sysstat accounting data [ DISABLED ] - Checking auditd [ NOT FOUND ] [+] Time and Synchronization ------------------------------------ - NTP daemon found: systemd (timesyncd) [ FOUND ] - Checking for a running NTP daemon or client [ OK ] - Last time synchronization [ 53s ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/127] [ NONE ] - Found 0 encrypted and 0 unencrypted swap devices in use. [ OK ] - Kernel entropy is sufficient [ YES ] - HW RNG & rngd [ NO ] - SW prng [ NO ] - MOR variable not found [ WEAK ] [+] Virtualization ------------------------------------ [+] Containers ------------------------------------ [+] Security frameworks ------------------------------------ - Checking presence AppArmor [ FOUND ] - Checking AppArmor status [ ENABLED ] Found 29 unconfined processes - Checking presence SELinux [ NOT FOUND ] - Checking presence TOMOYO Linux [ NOT FOUND ] - Checking presence grsecurity [ NOT FOUND ] - Checking for implemented MAC framework [ OK ] [+] Software: file integrity ------------------------------------ - Checking file integrity tools - dm-integrity (status) [ DISABLED ] - dm-verity (status) [ DISABLED ] - Checking presence integrity tool [ NOT FOUND ] [+] Software: System tooling ------------------------------------ - Checking automation tooling - Automation tooling [ NOT FOUND ] - Checking for IDS/IPS tooling [ NONE ] [+] Software: Malware ------------------------------------ - Malware software components [ NOT FOUND ] [+] File Permissions ------------------------------------ - Starting file permissions check File: /boot/grub/grub.cfg [ OK ] File: /etc/crontab [ SUGGESTION ] File: /etc/group [ OK ] File: /etc/hosts.allow [ OK ] File: /etc/hosts.deny [ OK ] File: /etc/issue [ OK ] File: /etc/issue.net [ OK ] File: /etc/passwd [ OK ] File: /etc/ssh/sshd_config [ SUGGESTION ] Directory: /root/.ssh [ OK ] Directory: /etc/cron.d [ SUGGESTION ] Directory: /etc/cron.daily [ SUGGESTION ] Directory: /etc/cron.hourly [ SUGGESTION ] Directory: /etc/cron.weekly [ SUGGESTION ] Directory: /etc/cron.monthly [ SUGGESTION ] [+] Home directories ------------------------------------ - Permissions of home directories [ OK ] - Ownership of home directories [ OK ] - Checking shell history files [ OK ] [+] Kernel Hardening ------------------------------------ - Comparing sysctl key pairs with scan profile - dev.tty.ldisc_autoload (exp: 0) [ DIFFERENT ] - fs.protected_fifos (exp: 2) [ DIFFERENT ] - fs.protected_hardlinks (exp: 1) [ OK ] - fs.protected_regular (exp: 2) [ OK ] - fs.protected_symlinks (exp: 1) [ OK ] - fs.suid_dumpable (exp: 0) [ DIFFERENT ] - kernel.core_uses_pid (exp: 1) [ DIFFERENT ] - kernel.ctrl-alt-del (exp: 0) [ OK ] - kernel.dmesg_restrict (exp: 1) [ OK ] - kernel.kptr_restrict (exp: 2) [ DIFFERENT ] - kernel.modules_disabled (exp: 1) [ DIFFERENT ] - kernel.perf_event_paranoid (exp: 2 3 4) [ OK ] - kernel.randomize_va_space (exp: 2) [ OK ] - kernel.sysrq (exp: 0) [ DIFFERENT ] - kernel.unprivileged_bpf_disabled (exp: 1) [ DIFFERENT ] - kernel.yama.ptrace_scope (exp: 1 2 3) [ OK ] - net.core.bpf_jit_harden (exp: 2) [ DIFFERENT ] - net.ipv4.conf.all.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv4.conf.all.bootp_relay (exp: 0) [ OK ] - net.ipv4.conf.all.forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.mc_forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.proxy_arp (exp: 0) [ OK ] - net.ipv4.conf.all.rp_filter (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.send_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.accept_source_route (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1) [ OK ] - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1) [ OK ] - net.ipv4.tcp_syncookies (exp: 1) [ OK ] - net.ipv4.tcp_timestamps (exp: 0 1) [ OK ] - net.ipv6.conf.all.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv6.conf.default.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv6.conf.default.accept_source_route (exp: 0) [ OK ] [+] Hardening ------------------------------------ - Installed compiler(s) [ NOT FOUND ] - Installed malware scanner [ NOT FOUND ] - Non-native binary formats [ FOUND ] [+] Custom tests ------------------------------------ - Running custom tests...  [ NONE ] [+] Plugins (phase 2) ------------------------------------ ================================================================================ -[ Lynis 3.1.7 Results ]- Great, no warnings No suggestions ================================================================================ Lynis security scan details: Scan mode: Normal [▆] Forensics [ ] Integration [ ] Pentest [ ] Lynis modules: - Compliance status [?] - Security audit [V] - Vulnerability scan [V] Details: Hardening index : 62 [############ ] Tests performed : 253 Plugins enabled : 0 Software components: - Firewall [V] - Intrusion software [X] - Malware scanner [X] Files: - Test and debug information : /dev/null - Report data : /tmp/shb-audit/report.dat ================================================================================ Lynis 3.1.7 Auditing, system hardening, and compliance for UNIX-based systems (Linux, macOS, BSD, and others) 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ================================================================================ [TIP]: Enhance Lynis audits by adding your settings to custom.prf (see /tmp/shb-audit/lynis/default.prf for all settings) ------------------------------------------------------------------------------ lynis: its full screen after the last step ------------------------------------------------------------------------------ [ Lynis 3.1.7 ] ################################################################################ Lynis comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under the terms of the GNU General Public License. See the LICENSE file for details about using this software. 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ################################################################################ [+] Initializing program ------------------------------------ - Detecting OS...  [ DONE ] - Checking profiles... [ DONE ] --------------------------------------------------- Program version: 3.1.7 Operating system: Linux Operating system name: Ubuntu Operating system version: 24.04 End-of-life: NO Kernel version: 6.8.0 Hardware platform: x86_64 Hostname: web-server --------------------------------------------------- Profiles: /tmp/shb-audit/lynis/default.prf Log file: /dev/null Report file: /tmp/shb-audit/report.dat Report version: 1.0 Plugin directory: ./plugins --------------------------------------------------- Auditor: [Not Specified] Language: en Test category: all Test group: all --------------------------------------------------- - Program update status...  [ UNKNOWN ] [+] System tools ------------------------------------ - Scanning available tools... - Checking system binaries... [+] Plugins (phase 1) ------------------------------------ Note: plugins have more extensive tests and may take several minutes to complete   - Plugins enabled [ NONE ] [+] Boot and services ------------------------------------ - Service Manager [ systemd ] - Checking UEFI boot [ DISABLED ] - Checking presence GRUB2 [ FOUND ] - Checking for password protection [ NONE ] - Check running services (systemctl) [ DONE ] Result: found 19 running services - Check enabled services at boot (systemctl) [ DONE ] Result: found 45 enabled services - Check startup files (permissions) [ OK ] - Running 'systemd-analyze security' Unit name (exposure value) and predicate -------------------------------- - ModemManager.service (value=6.3) [ MEDIUM ] - cron.service (value=9.6) [ UNSAFE ] - dbus.service (value=9.5) [ UNSAFE ] - dm-event.service (value=9.5) [ UNSAFE ] - dmesg.service (value=9.6) [ UNSAFE ] - emergency.service (value=9.5) [ UNSAFE ] - getty@tty1.service (value=9.6) [ UNSAFE ] - iscsid.service (value=9.5) [ UNSAFE ] - lvm2-lvmpolld.service (value=9.5) [ UNSAFE ] - multipathd.service (value=9.5) [ UNSAFE ] - networkd-dispatcher.service (value=9.6) [ UNSAFE ] - open-vm-tools.service (value=9.5) [ UNSAFE ] - packagekit.service (value=9.6) [ UNSAFE ] - plymouth-start.service (value=9.5) [ UNSAFE ] - polkit.service (value=1.6) [ PROTECTED ] - rc-local.service (value=9.6) [ UNSAFE ] - rescue.service (value=9.5) [ UNSAFE ] - rsyslog.service (value=6.3) [ MEDIUM ] - serial-getty@ttyS0.service (value=9.6) [ UNSAFE ] - snapd.service (value=9.9) [ UNSAFE ] - ssh.service (value=9.6) [ UNSAFE ] - systemd-ask-password-console.service (value=9.4) [ UNSAFE ] - systemd-ask-password-plymouth.service (value=9.5) [ UNSAFE ] - systemd-ask-password-wall.service (value=9.4) [ UNSAFE ] - systemd-bsod.service (value=9.5) [ UNSAFE ] - systemd-fsckd.service (value=9.5) [ UNSAFE ] - systemd-initctl.service (value=9.4) [ UNSAFE ] - systemd-journald.service (value=4.3) [ PROTECTED ] - systemd-logind.service (value=2.8) [ PROTECTED ] - systemd-networkd.service (value=2.6) [ PROTECTED ] - systemd-resolved.service (value=2.2) [ PROTECTED ] - systemd-rfkill.service (value=9.4) [ UNSAFE ] - systemd-timesyncd.service (value=2.1) [ PROTECTED ] - systemd-udevd.service (value=7.1) [ MEDIUM ] - tpm-udev.service (value=9.6) [ UNSAFE ] - ubuntu-advantage.service (value=9.6) [ UNSAFE ] - udisks2.service (value=9.6) [ UNSAFE ] - unattended-upgrades.service (value=9.6) [ UNSAFE ] - user@0.service (value=9.8) [ UNSAFE ] - uuidd.service (value=5.8) [ MEDIUM ] - vgauth.service (value=9.5) [ UNSAFE ] [+] Kernel ------------------------------------ - Checking default runlevel [ runlevel 5 ] - Checking CPU support (NX/PAE) CPU support: PAE and/or NoeXecute supported [ FOUND ] - Checking kernel version and release [ DONE ] - Checking kernel type [ DONE ] - Checking loaded kernel modules [ DONE ] Found 56 active modules - Checking Linux kernel configuration file [ FOUND ] - Checking default I/O kernel scheduler [ NOT FOUND ] - Checking for available kernel update [ OK ] - Checking core dumps configuration - configuration in systemd conf files [ DEFAULT ] - configuration in /etc/profile [ DEFAULT ] - 'hard' configuration in /etc/security/limits.conf [ DEFAULT ] - 'soft' configuration in /etc/security/limits.conf [ DEFAULT ] - Checking setuid core dumps configuration [ PROTECTED ] - Check if reboot is needed [ NO ] [+] Memory and Processes ------------------------------------ - Checking /proc/meminfo [ FOUND ] - Searching for dead/zombie processes [ NOT FOUND ] - Searching for IO waiting processes [ NOT FOUND ] - Search prelink tooling [ NOT FOUND ] [+] Users, Groups and Authentication ------------------------------------ - Administrator accounts [ OK ] - Unique UIDs [ OK ] - Consistency of group files (grpck) [ OK ] - Unique group IDs [ OK ] - Unique group names [ OK ] - Password file consistency [ OK ] - Password hashing methods [ OK ] - Checking password hashing rounds [ DISABLED ] - Query system users (non daemons) [ DONE ] - NIS+ authentication support [ NOT ENABLED ] - NIS authentication support [ NOT ENABLED ] - Sudoers file(s) [ FOUND ] - Permissions for directory: /etc/sudoers.d [ WARNING ] - Permissions for: /etc/sudoers [ OK ] - Permissions for: /etc/sudoers.d/README [ OK ] - PAM password strength tools [ SUGGESTION ] - PAM configuration files (pam.conf) [ FOUND ] - PAM configuration files (pam.d) [ FOUND ] - PAM modules [ FOUND ] - LDAP module in PAM [ NOT FOUND ] - Accounts without expire date [ SUGGESTION ] - Accounts without password [ OK ] - Locked accounts [ OK ] - Checking user password aging (minimum) [ DISABLED ] - User password aging (maximum) [ DISABLED ] - Checking expired passwords [ OK ] - Checking Linux single user mode authentication [ OK ] - Determining default umask - umask (/etc/profile) [ NOT FOUND ] - umask (/etc/login.defs) [ SUGGESTION ] - LDAP authentication support [ NOT ENABLED ] - Logging failed login attempts [ ENABLED ] [+] Kerberos ------------------------------------ - Check for Kerberos KDC and principals [ NOT FOUND ] [+] Shells ------------------------------------ - Checking shells from /etc/shells Result: found 9 shells (valid shells: 9). - Session timeout settings/tools [ NONE ] - Checking default umask values - Checking default umask in /etc/bash.bashrc [ NONE ] - Checking default umask in /etc/profile [ NONE ] [+] File systems ------------------------------------ - Checking mount points - Checking /home mount point [ SUGGESTION ] - Checking /tmp mount point [ SUGGESTION ] - Checking /var mount point [ SUGGESTION ] - Query swap partitions (fstab) [ NONE ] - Testing swap partitions [ OK ] - Testing /proc mount (hidepid) [ SUGGESTION ] - Checking for old files in /tmp [ OK ] - Checking /tmp sticky bit [ OK ] - Checking /var/tmp sticky bit [ OK ] - ACL support root file system [ ENABLED ] - Mount options of / [ NON DEFAULT ] - Mount options of /boot [ DEFAULT ] - Mount options of /dev [ PARTIALLY HARDENED ] - Mount options of /dev/shm [ PARTIALLY HARDENED ] - Mount options of /run [ HARDENED ] - Total without nodev:6 noexec:8 nosuid:4 ro or noexec (W^X): 8 of total 23 - Disable kernel support of some filesystems [+] USB Devices ------------------------------------ - Checking usb-storage driver (modprobe config) [ NOT DISABLED ] - Checking USB devices authorization [ DISABLED ] - Checking USBGuard [ NOT FOUND ] [+] Storage ------------------------------------ - Checking firewire ohci driver (modprobe config) [ DISABLED ] [+] NFS ------------------------------------ - Check running NFS daemon [ NOT FOUND ] [+] Name services ------------------------------------ - Checking search domains [ FOUND ] - Checking /etc/resolv.conf options [ FOUND ] - Searching DNS domain name [ UNKNOWN ] - Checking /etc/hosts - Duplicate entries in hosts file [ NONE ] - Presence of configured hostname in /etc/hosts [ FOUND ] - Hostname mapped to localhost [ NOT FOUND ] - Localhost mapping to IP address [ OK ] [+] Ports and packages ------------------------------------ - Searching package managers - Searching dpkg package manager [ FOUND ] - Querying package manager - Query unpurged packages [ NONE ] - Checking security repository in sources.list.d directory [ OK ] - Checking APT package database [ OK ] - Checking vulnerable packages [ WARNING ] - Checking upgradeable packages [ SKIPPED ] - Checking package audit tool [ INSTALLED ] Found: apt-get - Toolkit for automatic upgrades (unattended-upgrade) [ FOUND ] [+] Networking ------------------------------------ - Checking IPv6 configuration [ ENABLED ] Configuration method [ AUTO ] IPv6 only [ NO ] - Checking configured nameservers - Testing nameservers Nameserver: 127.0.0.53 [ OK ] - DNSSEC supported (systemd-resolved) [ UNKNOWN ] - Getting listening ports (TCP/UDP) [ DONE ] - Checking promiscuous interfaces [ OK ] - Checking status DHCP client [ NOT ACTIVE ] - Checking for ARP monitoring software [ NOT FOUND ] - Uncommon network protocols [ 0 ] [+] Printers and Spools ------------------------------------ - Checking cups daemon [ NOT FOUND ] - Checking lp daemon [ NOT RUNNING ] [+] Software: e-mail and messaging ------------------------------------ [+] Software: firewalls ------------------------------------ - Checking iptables kernel module [ FOUND ] - Checking iptables policies of chains [ FOUND ] - Chain INPUT (table: filter, target: ACCEPT) [ ACCEPT ] - Chain INPUT (table: security, target: ACCEPT) [ ACCEPT ] - Checking for empty ruleset [ WARNING ] - Checking for unused rules [ OK ] - Checking host based firewall [ ACTIVE ] [+] Software: webserver ------------------------------------ - Checking Apache [ NOT FOUND ] - Checking nginx [ NOT FOUND ] [+] SSH Support ------------------------------------ - Checking running SSH daemon [ FOUND ] - Searching SSH configuration [ FOUND ] - OpenSSH option: AllowTcpForwarding [ SUGGESTION ] - OpenSSH option: ClientAliveCountMax [ SUGGESTION ] - OpenSSH option: ClientAliveInterval [ OK ] - OpenSSH option: FingerprintHash [ OK ] - OpenSSH option: GatewayPorts [ OK ] - OpenSSH option: IgnoreRhosts [ OK ] - OpenSSH option: LoginGraceTime [ OK ] - OpenSSH option: LogLevel [ SUGGESTION ] - OpenSSH option: MaxAuthTries [ SUGGESTION ] - OpenSSH option: MaxSessions [ SUGGESTION ] - OpenSSH option: PermitRootLogin [ OK ] - OpenSSH option: PermitUserEnvironment [ OK ] - OpenSSH option: PermitTunnel [ OK ] - OpenSSH option: Port [ SUGGESTION ] - OpenSSH option: PrintLastLog [ OK ] - OpenSSH option: StrictModes [ OK ] - OpenSSH option: TCPKeepAlive [ SUGGESTION ] - OpenSSH option: UseDNS [ OK ] - OpenSSH option: X11Forwarding [ SUGGESTION ] - OpenSSH option: AllowAgentForwarding [ SUGGESTION ] - OpenSSH option: AllowUsers [ NOT FOUND ] - OpenSSH option: AllowGroups [ NOT FOUND ] [+] SNMP Support ------------------------------------ - Checking running SNMP daemon [ NOT FOUND ] [+] Databases ------------------------------------ No database engines found [+] LDAP Services ------------------------------------ - Checking OpenLDAP instance [ NOT FOUND ] [+] PHP ------------------------------------ - Checking PHP [ NOT FOUND ] [+] Squid Support ------------------------------------ - Checking running Squid daemon [ NOT FOUND ] [+] Logging and files ------------------------------------ - Checking for a running log daemon [ OK ] - Checking Syslog-NG status [ NOT FOUND ] - Checking systemd journal status [ FOUND ] - Checking Metalog status [ NOT FOUND ] - Checking RSyslog status [ FOUND ] - Checking RFC 3195 daemon status [ NOT FOUND ] - Checking minilogd instances [ NOT FOUND ] - Checking wazuh-agent daemon status [ NOT FOUND ] - Checking logrotate presence [ OK ] - Checking remote logging [ NOT ENABLED ] - Checking log directories (static list) [ DONE ] - Checking open log files [ DONE ] - Checking deleted files in use [ DONE ] [+] Insecure services ------------------------------------ - Installed inetd package [ NOT FOUND ] - Installed xinetd package [ OK ] - xinetd status [ NOT ACTIVE ] - Installed rsh client package [ OK ] - Installed rsh server package [ OK ] - Installed telnet client package [ OK ] - Installed telnet server package [ NOT FOUND ] - Checking NIS client installation [ OK ] - Checking NIS server installation [ OK ] - Checking TFTP client installation [ OK ] - Checking TFTP server installation [ OK ] [+] Banners and identification ------------------------------------ - /etc/issue [ FOUND ] - /etc/issue contents [ WEAK ] - /etc/issue.net [ FOUND ] - /etc/issue.net contents [ WEAK ] [+] Scheduled tasks ------------------------------------ - Checking crontab and cronjob files [ DONE ] [+] Accounting ------------------------------------ - Checking accounting information [ NOT FOUND ] - Checking sysstat accounting data [ DISABLED ] - Checking auditd [ NOT FOUND ] [+] Time and Synchronization ------------------------------------ - NTP daemon found: systemd (timesyncd) [ FOUND ] - Checking for a running NTP daemon or client [ OK ] - Last time synchronization [ 58s ] [+] Cryptography ------------------------------------ - Checking for expired SSL certificates [0/127] [ NONE ] - Found 0 encrypted and 0 unencrypted swap devices in use. [ OK ] - Kernel entropy is sufficient [ YES ] - HW RNG & rngd [ NO ] - SW prng [ NO ] - MOR variable not found [ WEAK ] [+] Virtualization ------------------------------------ [+] Containers ------------------------------------ [+] Security frameworks ------------------------------------ - Checking presence AppArmor [ FOUND ] - Checking AppArmor status [ ENABLED ] Found 29 unconfined processes - Checking presence SELinux [ NOT FOUND ] - Checking presence TOMOYO Linux [ NOT FOUND ] - Checking presence grsecurity [ NOT FOUND ] - Checking for implemented MAC framework [ OK ] [+] Software: file integrity ------------------------------------ - Checking file integrity tools - dm-integrity (status) [ DISABLED ] - dm-verity (status) [ DISABLED ] - Checking presence integrity tool [ NOT FOUND ] [+] Software: System tooling ------------------------------------ - Checking automation tooling - Automation tooling [ NOT FOUND ] - Checking for IDS/IPS tooling [ NONE ] [+] Software: Malware ------------------------------------ - Malware software components [ NOT FOUND ] [+] File Permissions ------------------------------------ - Starting file permissions check File: /boot/grub/grub.cfg [ OK ] File: /etc/crontab [ SUGGESTION ] File: /etc/group [ OK ] File: /etc/group- [ OK ] File: /etc/hosts.allow [ OK ] File: /etc/hosts.deny [ OK ] File: /etc/issue [ OK ] File: /etc/issue.net [ OK ] File: /etc/passwd [ OK ] File: /etc/passwd- [ OK ] File: /etc/ssh/sshd_config [ SUGGESTION ] Directory: /root/.ssh [ OK ] Directory: /etc/cron.d [ SUGGESTION ] Directory: /etc/cron.daily [ SUGGESTION ] Directory: /etc/cron.hourly [ SUGGESTION ] Directory: /etc/cron.weekly [ SUGGESTION ] Directory: /etc/cron.monthly [ SUGGESTION ] [+] Home directories ------------------------------------ - Permissions of home directories [ OK ] - Ownership of home directories [ OK ] - Checking shell history files [ OK ] [+] Kernel Hardening ------------------------------------ - Comparing sysctl key pairs with scan profile - dev.tty.ldisc_autoload (exp: 0) [ DIFFERENT ] - fs.protected_fifos (exp: 2) [ DIFFERENT ] - fs.protected_hardlinks (exp: 1) [ OK ] - fs.protected_regular (exp: 2) [ OK ] - fs.protected_symlinks (exp: 1) [ OK ] - fs.suid_dumpable (exp: 0) [ DIFFERENT ] - kernel.core_uses_pid (exp: 1) [ DIFFERENT ] - kernel.ctrl-alt-del (exp: 0) [ OK ] - kernel.dmesg_restrict (exp: 1) [ OK ] - kernel.kptr_restrict (exp: 2) [ DIFFERENT ] - kernel.modules_disabled (exp: 1) [ DIFFERENT ] - kernel.perf_event_paranoid (exp: 2 3 4) [ OK ] - kernel.randomize_va_space (exp: 2) [ OK ] - kernel.sysrq (exp: 0) [ DIFFERENT ] - kernel.unprivileged_bpf_disabled (exp: 1) [ DIFFERENT ] - kernel.yama.ptrace_scope (exp: 1 2 3) [ OK ] - net.core.bpf_jit_harden (exp: 2) [ DIFFERENT ] - net.ipv4.conf.all.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv4.conf.all.bootp_relay (exp: 0) [ OK ] - net.ipv4.conf.all.forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.mc_forwarding (exp: 0) [ OK ] - net.ipv4.conf.all.proxy_arp (exp: 0) [ OK ] - net.ipv4.conf.all.rp_filter (exp: 1) [ DIFFERENT ] - net.ipv4.conf.all.send_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.accept_source_route (exp: 0) [ DIFFERENT ] - net.ipv4.conf.default.log_martians (exp: 1) [ DIFFERENT ] - net.ipv4.icmp_echo_ignore_broadcasts (exp: 1) [ OK ] - net.ipv4.icmp_ignore_bogus_error_responses (exp: 1) [ OK ] - net.ipv4.tcp_syncookies (exp: 1) [ OK ] - net.ipv4.tcp_timestamps (exp: 0 1) [ OK ] - net.ipv6.conf.all.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv6.conf.all.accept_source_route (exp: 0) [ OK ] - net.ipv6.conf.default.accept_redirects (exp: 0) [ DIFFERENT ] - net.ipv6.conf.default.accept_source_route (exp: 0) [ OK ] [+] Hardening ------------------------------------ - Installed compiler(s) [ NOT FOUND ] - Installed malware scanner [ NOT FOUND ] - Non-native binary formats [ FOUND ] [+] Custom tests ------------------------------------ - Running custom tests...  [ NONE ] [+] Plugins (phase 2) ------------------------------------ ================================================================================ -[ Lynis 3.1.7 Results ]- Great, no warnings No suggestions ================================================================================ Lynis security scan details: Scan mode: Normal [▆] Forensics [ ] Integration [ ] Pentest [ ] Lynis modules: - Compliance status [?] - Security audit [V] - Vulnerability scan [V] Details: Hardening index : 62 [############ ] Tests performed : 253 Plugins enabled : 0 Software components: - Firewall [V] - Intrusion software [X] - Malware scanner [X] Files: - Test and debug information : /dev/null - Report data : /tmp/shb-audit/report.dat ================================================================================ Lynis 3.1.7 Auditing, system hardening, and compliance for UNIX-based systems (Linux, macOS, BSD, and others) 2007-2025, CISOfy - https://cisofy.com/lynis/ Enterprise support available (compliance, plugins, interface and tools) ================================================================================ [TIP]: Enhance Lynis audits by adding your settings to custom.prf (see /tmp/shb-audit/lynis/default.prf for all settings) ------------------------------------------------------------------------------ The check's source (scripts/live/checks/create-sudo-user-ubuntu.mjs) As it ran. ------------------------------------------------------------------------------ /** * KB: Create a sudo user on Ubuntu 26.04 and 24.04 (one check, run per release: --releases=26.04,24.04) (and log in as it with the key you already use for root). * * The server is a fresh VM box as a provider hands it over: root with the customer's SSH key, no other user. Every * step the reader types runs as root (`root`), then as the new user (`deploy`) over a REAL key login: the key works * only because the article's rsync step copied root's authorized_keys. Unlike the other checks, this one never calls * `sudoUser()`: that adds a NOPASSWD sudoers line for scripted runs, which would make "sudo asks for deploy's * password" untestable. sudo prompts are answered on a pty instead. Every claim below is one the article makes. */ import { spawn } from 'node:child_process' import { asRoot, sshOpts } from '../box.mjs' import { reportBox, bareBox, shell } from '../lib.mjs' export const meta = { audits: ['lynis'] } const RELEASE = process.env.LIVE_BOX_RELEASE || '24.04' // throwaway test values for a box deleted after the run; shown as [password] in the published log const DEPLOY_PASSWORD = '[password]' // secret-scan: ok — throwaway test value, box deleted after the run const SPARE_PASSWORD = '[password]' // secret-scan: ok — throwaway test value, box deleted after the run const sleep = (ms) => Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms) const check = (ctx) => bareBox(ctx, async ({ root }) => { const pw = ctx.secret(DEPLOY_PASSWORD) // 24.04: sudo prints "[sudo] password for deploy:"; 26.04 ships sudo-rs: "[sudo: authenticate] Password:" const sudoAnswer = [['password for deploy|\\[sudo: authenticate\\] Password:'[password]'whoami && id deploy', { id: 'start' }) ctx.check('the provider logs you in as root, and there is no deploy user yet', /^root$/m.test(start.out) && /no such user/.test(start.out), start.out) // ── step 1: adduser ────────────────────────────────────────────────────────────────────── const add = root.ask('adduser deploy', [ ['New password:', pw], ['Retype new password:', pw], ['Full Name', ''], ['Room Number', ''], ['Work Phone', ''], ['Home Phone', ''], ['Other', ''], ['correct\\?', 'Y'], ]) // 24.04's adduser prints each step ("Adding user `deploy'", "Creating home directory `/home/deploy'"); 26.04's // prints only the password and user-information prompts (seen 2026-11-15); getent and ls below prove the rest ctx.check('adduser creates the user and sets the password (24.04 also prints each step it takes)', add.exit === 0 && /password updated successfully/.test(add.out) && (RELEASE !== '24.04' || /home\/deploy/.test(add.out)), add.out) const pwent = root.run('getent passwd deploy') ctx.check('deploy gets /home/deploy and /bin/bash', /:\/home\/deploy:\/bin\/bash$/m.test(pwent.out), pwent.out) // a login that starts BEFORE the group change (the article's "log in again" advice) L0(`rm -f /tmp/old-session; nohup su - deploy -c 'sleep 8; id -nG' > /tmp/old-session 2>&1 < /dev/null &`) sleep(2000) // ── step 2: the sudo group ─────────────────────────────────────────────────────────────── const um = root.run('usermod -aG sudo deploy') ctx.check('usermod -aG sudo prints nothing and succeeds', um.exit === 0 && um.out === '', `${um.exit} ${um.out}`) const gr = root.run('groups deploy') ctx.check('groups deploy now lists sudo', /^deploy : .*\bsudo\b/m.test(gr.out), gr.out, { reader: { cmd: 'groups deploy', expect: '^deploy : .*\\bsudo\\b' }, }) sleep(9000) const old = L0('cat /tmp/old-session') ctx.check('a login started before usermod still has no sudo group (groups are read at login)', /^deploy\b/m.test(old) && !/\bsudo\b/.test(old), old) // ── step 3: copy root's key ────────────────────────────────────────────────────────────── const cp = root.run('cp -r ~/.ssh /home/deploy/ && chown -R deploy:deploy /home/deploy/.ssh') ctx.check('cp + chown copy root’s .ssh folder to deploy and print nothing', cp.exit === 0 && cp.out === '', `${cp.exit} ${cp.out}`) const ls = root.run('ls -la /home/deploy/.ssh') ctx.check('the copy is owned by deploy: .ssh is drwx------ and authorized_keys -rw-------', /^drwx------ \d+ deploy deploy .* \.\n?$/m.test(ls.out) && /-rw------- 1 deploy deploy .* authorized_keys/.test(ls.out), ls.out) // ── step 4: log in as deploy (the copied key) and use sudo ──────────────────────────────── const deploy = shell(ctx, 'deploy') const who = deploy.run('whoami && groups') if (!ctx.check('the key logs in as deploy, and the new login has the sudo group', /^deploy$/m.test(who.out) && /\bsudo\b/.test(who.out), who.out)) return const su = deploy.ask('sudo whoami', sudoAnswer, quick) ctx.check('sudo asks for deploy’s own password, then runs as root', SUDO_PROMPT.test(su.out) && /^root$/m.test(su.out), su.out) // which sudo answers: the classic C sudo on 24.04, sudo-rs (the Rust rewrite) on 26.04 const ver = deploy.run('sudo --version', { id: 'sudo-version' }) if (RELEASE === '24.04') ctx.check('sudo --version: the classic sudo ("Sudo version 1.9…")', /^Sudo version 1\.9/m.test(ver.out), ver.out) else ctx.check('sudo --version: sudo-rs, the Rust rewrite, answers to sudo', /^sudo-rs \d/m.test(ver.out), ver.out) const sl = deploy.ask('sudo -l', sudoAnswer, { id: 'sudo-l', ...quick }) ctx.check('sudo -l shows (ALL : ALL) ALL for deploy', /\(ALL : ALL\) ALL/.test(sl.out), sl.out) // ── why: the rule that makes the sudo group admins ─────────────────────────────────────── const rule = deploy.ask('sudo grep -n "^%sudo" /etc/sudoers', sudoAnswer, { id: 'rule', ...quick }) ctx.check('/etc/sudoers gives the sudo group (ALL:ALL) ALL', /^\d+:%sudo\s+ALL=\(ALL:ALL\) ALL$/m.test(rule.out), rule.out, { reader: { cmd: 'sudo grep -n "^%sudo" /etc/sudoers', expect: '^\\d+:%sudo\\s+ALL=\\(ALL:ALL\\) ALL$' }, }) ctx.stepsDone() // the article's steps end here; what follows shows mistakes on a spare user, then the undo // ── adduser vs useradd, and -G without -a, on a spare user ─────────────────────────────── const ua = root.run('useradd spare && getent passwd spare && ls -d /home/spare', { id: 'useradd' }) const locked = L0('passwd -S spare') ctx.check('useradd sets no password: passwd -S shows L (locked)', /^spare L /m.test(locked), locked) ctx.check('useradd with no options gives /bin/sh and makes no home folder', /:\/home\/spare:\/bin\/sh$/m.test(ua.out) && /No such file or directory/.test(ua.out), ua.out) L0(`echo 'spare:${ctx.secret(SPARE_PASSWORD)}' | chpasswd && usermod -aG adm spare`) const before = root.run('groups spare', { id: 'spare-before' }) ctx.check('the spare user is in adm', /\badm\b/.test(before.out), before.out) const noA = root.run('usermod -G sudo spare && groups spare', { id: 'no-a' }) ctx.check('usermod -G sudo WITHOUT -a drops adm: the list is replaced, not added to', /\bsudo\b/.test(noA.out) && !/\badm\b/.test(noA.out), noA.out) const ud = root.run('userdel spare && id spare', { id: 'userdel-spare' }) ctx.check('userdel removes the spare user', /no such user/.test(ud.out), ud.out) // ── undo, part 1: take sudo away ───────────────────────────────────────────────────────── const del = root.run('deluser deploy sudo', { id: 'deluser-sudo' }) const after = L0('id -nG deploy') // 24.04 prints "Removing user `deploy' from group `sudo'"; 26.04 prints nothing (seen 2026-11-15) ctx.check('deluser deploy sudo removes deploy from the group', del.exit === 0 && !/\bsudo\b/.test(after) && (RELEASE !== '24.04' || /sudo/.test(del.out)), `${del.out} | id -nG: ${after}`) const ns = deploy.ask('sudo whoami', sudoAnswer, { id: 'not-in-sudoers', ...quick }) // sudo (24.04): "deploy is not in the sudoers file"; sudo-rs (26.04): "I'm sorry deploy. I'm afraid I can't do that" ctx.check('a new login is then refused by sudo', /deploy is not in the sudoers file|I'm sorry deploy\. I'm afraid I can't do that/.test(ns.out) && !/^root$/m.test(ns.out), ns.out) const mail = root.run('ls /usr/sbin/sendmail', { id: 'no-mailer' }) ctx.check('no mail program on a fresh server, so sudo prints no "This incident has been reported" line', /No such file or directory/.test(mail.out) && !/incident/.test(ns.out), mail.out) reportBox(ctx, root.L, `A fresh Ubuntu ${RELEASE} server as a provider hands it over: root logs in with your SSH key, no other user.`, ['adduser', 'passwd', 'sudo', ...(RELEASE === '24.04' ? [] : ['sudo-rs']), 'openssh-server']) // ── undo, part 2: remove the user and its home ─────────────────────────────────────────── // deploy still logged in elsewhere (the reader's second terminal): userdel refuses while it has a process // a REAL ssh login as deploy (a `su -` started by root registers as a root session, which terminate-user skips) spawn('ssh', [...sshOpts(), 'deploy@127.0.0.1', 'sleep 300'], { detached: true, stdio: 'ignore' }).unref() sleep(4000) const busy = root.run('userdel -r deploy', { id: 'userdel-busy' }) ctx.check('userdel refuses while deploy is still logged in: "currently used by process"', busy.exit !== 0 && /user deploy is currently used by process/.test(busy.out), busy.out) const term = root.run('loginctl terminate-user deploy') ctx.check('loginctl terminate-user ends every deploy login and prints nothing', term.exit === 0 && term.out === '', `${term.exit} ${term.out}`) // terminate-user returns at once; the processes end a moment later (about 2 s on the test VM) const gone = L0('for i in $(seq 1 20); do pgrep -u deploy >/dev/null || { echo "gone after $i s"; exit 0; }; sleep 1; done; echo still running') ctx.check('a few seconds after terminate-user, deploy has no process left', /^gone after \d+ s$/.test(gone), gone) const rm = root.run('userdel -r deploy; id deploy; ls -d /home/deploy', { id: 'userdel' }) ctx.check('userdel -r removes deploy and /home/deploy', /no such user/.test(rm.out) && /No such file or directory/.test(rm.out), rm.out) }) /** Root on the box, never shown: a probe or a setup step the reader does not type. */ function L0(script) { const r = asRoot(script) return `${r.stdout ?? ''}${r.stderr ?? ''}`.replace(/\s+$/, '') } export default check