Represents a user on the host system.
NOTE To use User, you must explicitly import it with require "system/user"
Users can be retrieved by either username or their user ID:
require "system/user" System::User.find_by name: "root" System::User.find_by id: "0"
Returns the user associated with the given username.
Returns the user associated with the given ID.
Returns the user associated with the given username.
Returns the user associated with the given ID.
Returns true if this reference is the same as other.
The user's primary group identifier.
The user's home directory.
The user's identifier.
The user's real or full name.
The user's login shell.
The user's username.
Crystal::System::User
Crystal::System::User
Crystal::System::User
Reference
Reference
Reference
Object
Object
Object
Returns the user associated with the given username.
Raises NotFoundError if no such user exists.
Returns the user associated with the given ID.
Raises NotFoundError if no such user exists.
Returns the user associated with the given username.
Returns nil if no such user exists.
Returns the user associated with the given ID.
Returns nil if no such user exists.
Returns true if this reference is the same as other. Invokes same?.
The user's real or full name.
May not be present on all platforms. Returns the same value as #username if neither a real nor full name is available.
© 2012–2026 Manas Technology Solutions.
Licensed under the Apache License, Version 2.0.
https://crystal-lang.org/api/1.19.0/System/User.html