Description
Every file and directory on local filesystems (ext2/3/4, XFS, Btrfs, JFS, F2FS, FAT, exFAT and tmpfs) belongs to a user and a group that exist in the account databases.
The scan stays on each filesystem (find -xdev). Network filesystems are not scanned: their IDs
come from another system.
Rationale
Orphaned files usually come from deleted accounts or from archives extracted with their original IDs. The next account or group created with that numeric ID becomes their owner and can read or change them. They also point to incomplete account clean-up.
Impact
None: the control only reports.
Audit
For each local filesystem listed by findmnt -knr -o TARGET -t ext2,ext3,ext4,xfs,btrfs,jfs,f2fs,vfat,exfat,tmpfs, run
find <mount point> -xdev \( -nouser -o -nogroup \). The command must print nothing.
Automated: every check must pass. Scanners report each check by its id.
unowned
Files and directories without a known owner or group on local filesystems.
script: |
out=$(for m in $(findmnt -knr -o TARGET -t ext2,ext3,ext4,xfs,btrfs,jfs,f2fs,vfat,exfat,tmpfs); do
find "$m" -xdev \( -nouser -o -nogroup \) -print 2>/dev/null
done | sort -u)
[ -z "$out" ] && { echo "every file has a known owner and group"; exit 0; }
echo "$(printf '%s\n' "$out" | wc -l) item(s):"
printf '%s\n' "$out" | head -n 20 | while IFS= read -r f; do stat -c '%n %u:%g' "$f"; done
exit 1
Remediation
For each reported item, find where it comes from (ls -ln, dpkg -S), then:
- give it to its current owner with
chown <user>:<group> <file>; - or delete it if it belonged to a removed account and is no longer needed.
Restore files from archives with tar --no-same-owner (default for non-root) or fix the
owner right after extraction.
References
- find(1), Ubuntu manual pages (-nouser, -nogroup) Canonical, vendor-doc, accessed 2026-10-19
- ANSSI-BP-028 v2.0 - Recommandations de configuration d'un système GNU/Linux (R53) ANSSI, guide, accessed 2026-10-19
Mappings
| Framework | ID | Relation |
|---|---|---|
| ANSSI-BP-028 - Recommandations de configuration d'un système GNU/Linux2.0 | R53 | equivalent |
| NIST SP 800-53 Rev. 55.1.1 | AC-3 | related |
How this control relates to the other framework's: equivalent, stricter, looser, partial or related.
Threats mitigated
| Taxonomy | ID |
|---|---|
| Common Weakness Enumeration | CWE-283 |
Related controls
- related
CB-UBU-AUTH-023Disable accounts that are no longer used
People and lifecycle
| Authors |
|
| Verified | 2026-10-19 by Sn0wAlice on 20.04, Proxmox VM 2520, Ubuntu 20.04 cloud image, kernel 5.4.0-216-generic. Passes on fresh install; file with unknown UID/GID detected. |
| Verified | 2026-10-19 by Sn0wAlice on 22.04, Proxmox VM 2522, Ubuntu 22.04 cloud image, kernel 5.15.0-198-generic. Passes on fresh install; file with unknown UID/GID detected. |
| Verified | 2026-10-19 by Sn0wAlice on 24.04, Proxmox VM 2524, Ubuntu 24.04 cloud image, kernel 6.8.0-147-generic. Passes on fresh install; file with unknown UID/GID detected. |
| Verified | 2026-10-19 by Sn0wAlice on 26.04, Proxmox VM 2526, Ubuntu 26.04 cloud image, kernel 7.0.0-38-generic. Passes on fresh install; file with unknown UID/GID detected. |
| Introduced in | v0.1.0 |
| Created, updated | 2026-10-19, 2026-10-19 |
| Translations | fr |