Skip to content

Conversation

@wojcik91
Copy link
Contributor

Add a fallback method for checking current user in the DEB & RPM package postinst script. This should enable the package to determine current user when being installed from a GUI frontend (Ubuntu App Center etc).

Closes #755

@wojcik91 wojcik91 self-assigned this Jan 12, 2026
@wojcik91 wojcik91 added the bug Something isn't working label Jan 12, 2026
filipslezaklab
filipslezaklab previously approved these changes Jan 12, 2026
fi

# Method 2: Check loginctl for latest session
username=$(loginctl list-users --no-legend | awk '$1 >= 1000 {print $2; exit}')

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is correct on a multi-user environment

Comment on lines +21 to +22
SESSION_ID=$(loginctl show-seat seat0 -p ActiveSession --value)
username=$(loginctl show-session "$SESSION_ID" -p Name --value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's correct to rely on seat0 being the one running the installation, but I don't know much about multi-seat environments so I could be wrong. Maybe it's better to do something like loginctl show-session $(cat /proc/self/sessionid) -p Name --value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not very familiar with multi-seat setups, but my understanding is that in typical workstation situation it's always the default seat0 since each seat corresponds to a set of hardware (keyboard, mouse etc).
There would be more than one in for example some thin-client setup, which we don't explicitly support.

I did run some tests on Ubuntu 22/24, Debian 12/13 and Fedora and this approach seems to work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

User not added to defguard group on ubuntu 22 and 24

4 participants