Skip to content

Instantly share code, notes, and snippets.

@lynxplay
Last active October 2, 2021 21:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lynxplay/52f836dd53b8885c4d4d58fb21189d03 to your computer and use it in GitHub Desktop.
Save lynxplay/52f836dd53b8885c4d4d58fb21189d03 to your computer and use it in GitHub Desktop.
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