Index
  • get groupList(): (Group & { members: string[] })[]

    Every group, by gid: the registry, plus the primary group of any user it does not yet name.

    Returns (Group & { members: string[] })[]

  • Creates a group. gid defaults to the first free one from 1000 (from 100 to 999 for a system group).

    Parameters

    • name: string
    • Optionalgid: number
    • system: boolean = false

    Returns Promise<Group>

  • Adds a key to the user's authorized_keys (a directory of mode 0700, a file of 0600, both theirs). A key already there is not added twice.

    Parameters

    Returns Promise<void>

  • Gives an account another uid, and hands over the files in its home directory (/etc/shadow is keyed by name, so it does not change).

    Parameters

    • uid: number
    • newUid: number

    Returns Promise<void>

  • Creates the group when it is missing; a preferred gid is used if it is free, else the first free system gid.

    Parameters

    • name: string
    • OptionalpreferredGid: number

    Returns Promise<Group>

  • The user's public key, making the pair first if there is none. The private half is encrypted under password, which has to be the user's current one. A key that exists but cannot be unlocked with it (an administrator changed the password since) is not replaced: that would destroy it.

    Parameters

    • uid: number
    • password: string

    Returns Promise<JsonWebKey>

  • The lowest unused id from from, among the users' and the groups'.

    Parameters

    • kind: "uid" | "gid"
    • from: number
    • to: number = Infinity

    Returns number

  • Renames a group and/or gives it another gid; users in it follow, but files keep the gid they have.

    Parameters

    • gid: number
    • changes: { gid?: number; name?: string }

    Returns Promise<Group>

  • Changes uid's password (the first terminal's user, when none is given), after checking the old one

    Parameters

    • oldPassword: string
    • newPassword: string
    • uid: number = ...

    Returns Promise<void>

  • Gives the user a new name everywhere it is written: the account, /etc/shadow, and the private group when it had one.

    Parameters

    • uid: number
    • name: string

    Returns Promise<void>

  • An administrator sets a password without knowing the old one. The hash and /etc/shadow are rewritten, and a lock is lifted. The private key in ~/.ssh stays encrypted under the old password, so it can no longer be unlocked, as with an encrypted home directory on Linux; nothing at login needs it.

    Parameters

    • uid: number
    • newPassword: string

    Returns Promise<void>

  • A session for username without a password, for a login that has already been proved some other way (a key). An expired account is closed to it as to any login; a locked password is not (that stops passwords, as on Linux). Fails with the same message as a wrong password so a name cannot be probed.

    Parameters

    • username: string

    Returns Promise<{ cred: Credentials; user: User }>

  • Adds or removes a user from a group's members.

    Parameters

    • uid: number
    • gid: number
    • member: boolean

    Returns Promise<void>

  • Signs data with the user's key (making the pair first if there is none), for a login to another machine. The private key is decrypted here with the user's password and never leaves; the caller gets the public key and the signature.

    Parameters

    Returns Promise<{ publicKey: JsonWebKey; signature: Uint8Array }>