Skip to content

Users and groups

Creating, changing and deleting users and groups, managing passwords and working with root rights through sudo and su.

Basics: The important files: passwd, shadow, group, sudoers

Look up users and groups

  • groups


    Show the groups a user belongs to.

  • getent


    Look up users, groups, hosts and services.

Manage users

  • adduser


    Create a new user step by step (Debian, Ubuntu).

  • useradd


    Create a user in one command, for scripts and every distribution.

  • usermod


    Change groups, shell, name or lock of a user.

  • passwd


    Set, lock, unlock or expire a password.

  • chage


    Set password ageing and account expiry.

  • deluser


    Delete a user or remove it from a group (Debian, Ubuntu).

  • userdel


    Delete a user account on every distribution.

Manage groups

  • addgroup


    Create a group or add a user to it (Debian, Ubuntu).

  • groupadd


    Create a group on every distribution.

  • gpasswd


    Add or remove group members.

  • delgroup


    Delete a group or remove a user from it (Debian, Ubuntu).

Root rights

  • su


    Switch to another user, by default root.

  • sudo


    Run commands as root or another user.

  • visudo


    Edit the sudo configuration safely.