The Shared Permissions Audit
In Ubuntu Linux, file permissions are divided into three distinct categories: the individual User owner, the shared Group owner, and Everyone else. In complex server environments, multiple developers are often added to a single group (like dev-team or www-data) so they can collaborate on the same web files without constantly overwriting each other’s permissions. However, if a junior developer accidentally creates a sensitive database backup file and assigns it to a broad group, you have a major security leak. To audit shared access, you must instruct the Linux engine to scan the filesystem exclusively for files assigned to a specific group.
Using the find Command with -group
The Linux find command utilizes the -group flag to instantly isolate files based solely on their assigned group ownership.
- Open your Terminal application (Ctrl + Alt + T) or log into your server via SSH.
- To scan the entire
/var/www/directory and explicitly return only files assigned to thedockergroup, type the following command exactly:sudo find /var/www/ -type f -group docker - Press Enter and provide your administrator password.
Cleaning Up Deleted Groups
This command is essential for system maintenance. If you completely delete an old user group from the server, the files they created are not deleted. Instead, the files become orphaned and simply display the old group’s numerical ID. You can use a variation of this command—sudo find / -nogroup—to scan the entire hard drive for any file that belongs to a deleted group, allowing you to instantly identify broken permission chains and secure the data.