Last 12 weeks · 0 commits
4 of 6 standards met
This adds detection for RedHat-based distros as well as returning the lowest _active_ UID after UID_MIN, as discussed in #1. I gave it some basic testing on CentOS and I'm confident it'll work fine on other distros, even when the two files don't exist (in which case we fall back to the hardcoded UIDs). I didn't see the need to support 4 year old Fedora, so that's not included. Leaving this up for discussion, as it's pretty much a rewrite and also changes the behaviour to async (required by ).
From wikipedia: Some POSIX systems allocate UIDs for new users starting from 500 (OS X, Red Hat Enterprise Linux), others start at 1000 (openSUSE, Debian[5]). On many Linux systems, these ranges are specified in /etc/login.defs, for useradd and similar tools. I think an approach would be: 1) read , return UID_MIN if found. Here's the relevant section from Arch Linux: 2) if there's no uid from step 1, try to detect distribution, maybe through or similar, and fall back to a hardcoded list of uids for distributions.
Repository: sindresorhus/default-uid. Description: Get the system default UID Stars: 13, Forks: 6. Primary language: JavaScript. Languages: JavaScript (100%). License: MIT. Latest release: v2.0.0 (5y ago). Open PRs: 0, open issues: 0. Last activity: 2y ago. Community health: 85%. Top contributors: sindresorhus, Richienb.