Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 907418 - Removing acct-group from world does not change /etc/group and /etc/gshadow files
Summary: Removing acct-group from world does not change /etc/group and /etc/gshadow files
Status: RESOLVED CANTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: AMD64 Linux
: Normal enhancement
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-30 15:00 UTC by Lemon Lime
Modified: 2023-05-30 15:30 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lemon Lime 2023-05-30 15:00:48 UTC
When you remove a acct-group package (be it a dependency or a manually installed_ from your system, the group is still available in your system (seen in how they are still visible in the etc/group and /etc/gshadow files)

Shouldn't portage run "groupdel" when uninstalling said groups?

Or is this behavior intended?
Comment 1 Mike Gilbert gentoo-dev 2023-05-30 15:04:14 UTC
That's intended behavior. It is not safe to remove the users/groups without first cleaning up any files leftover on the filesystem. Removing the user/group allows the id to be re-used by some new user/group, and they would end up having access to files they shouldn't.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2023-05-30 15:13:13 UTC
What Mike said.  The ebuilds can't guarantee it's safe to remove users/groups, so we merely lock the users.  Even if we literally traversed the file system for ownership, that:

1) would make removals super slow,

2) would be vulnerable to races,

3) wouldn't guarantee that the user/group doesn't own files on non-mounted fileystem,

4) wouldn't guarantee that the user/group isn't used in some configs.

I'm afraid there's nothing we can do about it.  Someone could write a tool to perform automated scan & cleanup of "removed" users and groups but that requires time that none of the us probably has at the moment.
Comment 3 Lemon Lime 2023-05-30 15:21:21 UTC
I see. I couldn't have imagined the security risks and technical challenges it implies.

Thank you for the quick response and all your work! It is really appreciated. 

I'll mark this as resolved

Have a good day