|
|
|
|
|
by AceJohnny2
3482 days ago
|
|
> It turns out that id gets this information from the /etc/passwd and /etc/group files. $ strace -e open id 1000
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 3
open("/etc/group", O_RDONLY|O_CLOEXEC) = 3
Well, by default yes. But if your system is configured to use NIS/YP or LDAP (through NSS/Name Service Switch), then these files won't have all the information (though they'll likely have a few, it's important to have local fallbacks in case of network issues!)A more generic tool is 'getent', which will query all the underlying databases for you. For example: "getent passwd" or "getent group". Nevertheless, using strace to get a first approximation is an excellent exercise :) |
|