A quick dip in the man pages suggests running runuser -u <user> -- <command>. Making Crystal drop privileges is probably involved and pretty low level.
So I think I need to do in another way. I am facing a problem actually.
Normally all of my command called by my coded package manager , or most of them are supposed to be called as root.
The problem I am facing recently is when the time come ti install libre office … I don’t know why , this is the only package require to be build as normal user …
Normally in C and Linux, you would leverage on something like setuid(2) and setgid(2) to demote your current user (root) to run something as another one.
There is an old proposal on this subject from 2019 in GitHub:
While none of that has landed in Crystal yet, perhaps you can take a look to one of the PRs and use that code part of your project.