-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't start pkexec swhkd
, XDG_CONFIG_HOME not found
#201
Comments
I think it's because it's running as the |
Well, it's only running as root user because apparently it needs |
|
I may be missing something, I think it then does not make sense for |
The first problem is that The second problem is that You can also symlink your personal config file (i.e.
|
Hi, I am also having this issue using Fedora39 I think that the drop_privileges function is not working as expected when called here. Expected Behavior:When I run the program with XDG_CONFIG_HOME set my config file should be loaded. Actual:egg@astro-egg:~/code/swhkd$ ./target/release/swhks & pkexec ./target/release/swhkd
[1] 80270
[2024-01-08T00:26:34Z ERROR swhkd] XDG_RUNTIME_DIR has not been set.
[2024-01-08T00:26:34Z WARN swhkd] Running swhkd as root!
[2024-01-08T00:26:34Z ERROR swhkd] XDG_CONFIG_HOME has not been set.
[2024-01-08T00:26:35Z ERROR swhkd] XDG_RUNTIME_DIR has not been set.
[2024-01-08T00:26:35Z ERROR swhkd] Could not open evdev device at /dev/input/mouse1: Inappropriate ioctl for device (os error 25)
^C[2024-01-08T00:26:41Z WARN swhkd] Received SIGINT signal, exiting...
I tried to add the following right after drop_privileges to inspect the environment variables let load_config = || {
// Drop privileges to the invoking user.
perms::drop_privileges(invoking_uid);
let env_vars: Vec<(String, String)> = env::vars().collect();
// Print the environment variables
for (key, value) in env_vars {
println!("{}: {}", key, value);
}
.... I expected that this would show me my users environment variables but I got the root user instead. egg@astro-egg:~/code/swhkd$ ./target/release/swhks & pkexec ./target/release/swhkd
[1] 80966
[2024-01-08T00:29:29Z ERROR swhkd] XDG_RUNTIME_DIR has not been set.
[2024-01-08T00:29:29Z WARN swhkd] Running swhkd as root!
SHELL: /bin/bash
LANG: en_US.UTF-8
TERM: xterm-256color
COLORTERM: truecolor
PATH: /usr/sbin:/usr/bin:/sbin:/bin:/root/bin
LOGNAME: root
USER: root
HOME: /root
PKEXEC_UID: 1000
RUST_LOG: swhkd=warn
[2024-01-08T00:29:29Z ERROR swhkd] XDG_CONFIG_HOME has not been set.
[2024-01-08T00:29:30Z ERROR swhkd] XDG_RUNTIME_DIR has not been set.
[2024-01-08T00:29:30Z ERROR swhkd] Could not open evdev device at /dev/input/mouse1: Inappropriate ioctl for device (os error 25)
^C[2024-01-08T00:29:32Z WARN swhkd] Received SIGINT signal, exiting... Is it the case that after drop_privs is called, we should be seeing the effective user environment variables until raise_privileges() is called? |
This is definitely an issue with our privilege system but #201 (comment) shows how to work around it. We are actively working on improving this experience for users via our gsoc program. |
@Radical-Egg That definitely seems like a bug in our priv esc model. |
I have started
swhks &
in the background and am now trying to runpkexec swhkd
, but I receive all of these errors:I am running on Arch Linux using
river
.If I type in
echo $XDG_CONFIG_HOME
, I get the equivalent of$HOME/.config
, so I am not sure whyswhkd
can't recognize it. Any ideas?The text was updated successfully, but these errors were encountered: