-
-
Notifications
You must be signed in to change notification settings - Fork 62
Open
Description
Version Information:
- Distribution: NixOS
- swhkd version: Simple-Wayland-HotKey-Daemon 1.3.0-dev, built off c5c4071
Describe the bug:
In terminal emulators launched via swhkd, any command with sudo will not work, with error , the groups of the process may be missing. This occurs when the user's GID is not the same value as the UID.<user> is not in the sudoers file.
To Reproduce:
- Create a minimal config file:
super + enter
alacritty
- Start swhkd
swhks & sudo swhkd
- Launch the terminal, e.g.
Super + Enter
4. Run a command with sudo, e.g. sudo echo hi
4. Run the id
command to see groups of the current process.
Additional information:
I'm very confused by this bug as environment variables like $USER
, $UID
, $LOGNAME
, $HOME
all seem normal.
The cause is from here
Line 198 in c5c4071
setgid(Gid::from_raw(invoking_uid)).unwrap(); |
While for most Linux distributions UID = GID (e.g. Ubuntu, Arch if I'm not wrong), this is not a universal rule.
We need to call initgroups()
to set the supplementary groups of the user as well.
Metadata
Metadata
Assignees
Labels
No labels