Skip to content

Feature request: Ability to change user and group #44

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

Closed
jprider63 opened this issue Oct 8, 2015 · 5 comments
Closed

Feature request: Ability to change user and group #44

jprider63 opened this issue Oct 8, 2015 · 5 comments

Comments

@jprider63
Copy link

I'd like to change the user and group of the forked process (I'm using Linux, but I think this would still make sense for Windows). I looked into implementing this myself, but it seems like there's extensive FFI use (ie runInteractiveProcess), and it could require some potentially breaking API changes.

Do you think this is feasible?

@snoyberg
Copy link
Collaborator

snoyberg commented Oct 9, 2015

When I've needed this I've always used sudo. I suppose adding some logic to the C part of the code to optionally call setuid and setgid should work. I can't think of a way to make this meaningful on Windows, however.

@jprider63
Copy link
Author

I'm currently using a script to change the group and user, which then calls the target executable. I avoided using sudo because I need to explicitly control argv inputs and was concerned about the shell having to parse the arguments.

For the API, maybe we could add two fields to CreateProcess called child_user :: Maybe String and child_group :: Maybe String. I could take a shot at implementing this if it seems reasonable to you.

@snoyberg
Copy link
Collaborator

Seems fine. My only question would be whether it should use a String or
expect Int (user ID). I'm fine either way.

Please note in the haddocks which OSs it's expected to work on.

On Fri, Oct 9, 2015, 9:50 PM JP [email protected] wrote:

I'm currently using a script to change the group and user, which then
calls the target executable. I avoided using sudo because I need to
explicitly control argv inputs and was concerned about the shell having to
parse the arguments.

For the API, maybe we could add two fields to CreateProcess called child_user
:: Maybe String and child_group :: Maybe String. I could take a shot at
implementing this if it seems reasonable to you.


Reply to this email directly or view it on GitHub
#44 (comment).

@jprider63
Copy link
Author

I just made a pull request with this implemented. I ended up going with CGid and CUid instead of String. I've only tested on unix with ghc, but I think other targets should be unaffected.

@snoyberg
Copy link
Collaborator

Implemented by PR #45, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants