Look a POSIX user up by name
const url = 'https://example.com/api/nss/user/name/example';const options = {method: 'GET'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/api/nss/user/name/exampleResolves a login name, matched byte for byte, to the account a host serves: uid, primary gid (after nss.auto_private_groups), every group with its name, home, shell, gecos and a status derived on read. A disabled or deleted account is served with nss.disabled_shell. Called by ssoossh-nss with a fleet key. 404 nss_not_found is the one answer a host may cache as a miss.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The login name, by the relaxed POSIX rules nss-systemd applies
Responses
Section titled “Responses”The account
object
object
Gecos is the rendered and sanitised nss.gecos_template output.
GID is the primary group id, after nss.auto_private_groups.
Groups is every membership, primary first, with the gid and the name together, so one user lookup answers both “which groups” and “what is group N called”.
object
GID is the group id.
Name is the group name, matched byte for byte like a user name.
Home is the home directory: the directory attribute, else nss.default_home expanded, else null.
KeyID is the fleet key that made the request, echoed for log correlation.
Name is the login name, stored verbatim from the directory and matched byte for byte.
Shell is the login shell path: the directory attribute, else nss.default_shell, else null. For a disabled or deleted account it is nss.disabled_shell.
Status is one of the NSSStatus* values.
UID is the user id. Frozen once stored: a changed directory value is held as a pending change until an admin accepts it.
Example generated
{ "data": { "gecos": "example", "gid": 1, "groups": [ { "gid": 1, "name": "example" } ], "home": "example", "key_id": "example", "name": "example", "shell": "example", "status": "example", "uid": 1 }, "error": "example"}Nss_bad_request: the name fails validation
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}Nss_unauthorized: the fleet key is missing, unknown, revoked, expired or wrong
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}Nss_forbidden: the source address is outside nss.source_allow_list
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}Nss_not_found, or nss_disabled when nss.enabled is false
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}Nss_rate_limited, with Retry-After
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}Unavailable: the name is not in the database and the directory could not be asked
object
Data is always null on an error response.
Error is a human-readable message. Branch on the HTTP status rather than this string; it is for humans and logs.
ErrorCode is a machine-readable error classifier. One of the error_code constants from internal/apitypes; use this to decide whether to retry or branch on the failure mode.
Example
{ "error": "certificate request \"9f1c…\" not found", "error_code": "not_found"}