Skip to main content

create_user

Function create_user 

Source
pub async fn create_user(
    context: &Context<'_>,
    user_name: &str,
    password: &str,
    primary_group: GroupIdentifier,
    user_identifier: Option<UserIdentifier>,
) -> Result<UserIdentifier>
Expand description

Creates a new user account with the specified parameters.

The account records /users/<user_name> as its home. The home directory itself is created lazily, at the first login, by VirtualFileSystem::ensure_user_home.

ยงErrors

  • InvalidUserName - The name does not satisfy [users::is_valid_user_name]
  • UserHomeAlreadyUsed - Another account records that home (for example a renamed account that kept it), or it exists and is not a directory owned by the new account
  • FailedToCreateUser(DuplicateUserName) - An account record with that name already exists, even one this firmware could not load
  • User identifier generation or assignment failures
  • File system operations (directory creation, file writing)
  • Random salt generation failures