Skip to content
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

id command expects id to have names but that's optional #117

Open
dlegaultbbry opened this issue Feb 19, 2019 · 4 comments

Comments

@dlegaultbbry
Copy link

commented Feb 19, 2019

The id command expects all given uids, gids and sgids to exist in textual form but I don't think this is required at all by the specs and limits the usefulness of the command.

See http://pubs.opengroup.org/onlinepubs/009695399/utilities/id.html

"If any of the user ID, group ID, effective user ID, effective group ID, or supplementary/multiple group IDs cannot be mapped by the system into printable user or group names, the corresponding "(%s)" and name argument shall be omitted from the corresponding format string."

@enh

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2019

Is there an easy way to reproduce this from the shell, or do I need to a C program that calls setgroups(2)?

@dlegaultbbry

This comment has been minimized.

Copy link
Author

commented Feb 20, 2019

On QNX we have a utility that can do that easily and I found that you can have something similar to this tool in this repo
http://git.skarnet.org/cgi-bin/cgit.cgi/s6/

http://www.skarnet.org/software/s6/s6-applyuidgid.html

@landley

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2019

sudo has -u and -g options.

@landley

This comment has been minimized.

Copy link
Owner

commented Feb 20, 2019

Ah, but I see it won't let even root select nonexisting ones. (That's why I had a todo item to add -u UID and -g GID[,...] to su, which I haven't done yet because I need to figure out what the -s and -c backwards compatibility stuff looks like with the "add arbitrary arguments to the end of the command line". I think it means when you do -u or -g the first argument isn't treated as a username, and when you add arguments it doesn't do -s unless you specify -s or -c...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.