Skip to content

Instantly share code, notes, and snippets.

@lynxplay
Last active October 2, 2021 21:22
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
An example case for the UnixSystem.java failure to retrieve uid, gid and groups if the user has no username
public class UnixSystemNameless {
public static void main(String[] args) {
final var unixSystem = new com.sun.security.auth.module.UnixSystem();
System.out.printf("username: %s%n", unixSystem.getUsername());
System.out.printf("uid: %d%n", unixSystem.getUid());
System.out.printf("gid: %d%n", unixSystem.getGid());
System.out.printf("groups: %s%n", java.util.Arrays.toString(unixSystem.getGroups()));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment