Cannot possibly work without effective root in forked process

484 views Asked by At

relatively naive question here - I always program for *nix through Mac but am not familiar with Linux.

I'm writing a terminal emulator in Rust. It forks itself and, in the child process, becomes /usr/bin/login via execle. This works perfectly in macOS. The implementation is here.

On Linux however, login prints "Cannot possibly work without effective root". I don't really know what this means. I can run my terminal emulator with sudo, but then the logged-in user is root, which I don't want. I want to start it as a normal user, and avoid this "effective root" error.

In an attempt to toubleshoot, I put a line of seteuid(0.into()).unwrap() in my program before execle, but that hangs the entirety of Pop!_OS on my machine and then prints

[xcb] Unknown sequence number while processing queue
[xcb] Most likely this is a multi-threaded client and XInitThreads has not been called
[xcb] Aborting, sorry about that.
velocity-sfml: ../../src/xcb_io.c:278: poll_for_event: Assertion `!xcb_xlib_threads_sequence_lost' failed.
zsh: IOT instruction (core dumped)  ./velocity-sfml

Do anyone know how I can give my program an "effective root" on Linux without launching it as root?

0

There are 0 answers