Skip to content

Linux & shell: Users & groups

6 Linux & shell commands: Users & groups. Click a command to see what each part does.

Index
6 items
Click a command to see what each part does.

Users & groups6

  • whoami; idWho am I?

    What each part does

    1. whoamiyour user name
    2. idyour user ID, primary group and all groups
  • groups <user>Which groups is a user in?

    What each part does

    1. groupslist group memberships (yours if no user given)
  • su - <user>Switch to another user

    What each part does

    1. susubstitute user
    2. -start a full login shell (their home folder and environment)
  • sudo useradd -m -s /bin/bash <user>Create a user with a home folder and bash

    What each part does

    1. useraddcreate a user account
    2. -m--create-home: create /home/<user> with the skeleton files
    3. -s /bin/bash--shell: login shell
  • sudo usermod -aG <group> <user>Add a user to a group (keep other groups)

    What each part does

    1. usermodmodify a user
    2. -a--append: add to the group (only valid with -G)
    3. -G <group>supplementary group(s). Without -a the user is REMOVED from groups not listed

    Tip Typical: sudo usermod -aG docker $USER, then log out and in again.

  • sudo passwd <user>Set or change a password

    What each part does

    1. passwdchange the password (your own if no user given, no sudo needed)

My DevOps Playbook by Angelo John Calleja

New runbook

GitHub not connected

Saving is handled by the site: the GitHub token is stored in Cloudflare, not in your browser. Enter the editor password (the EDITOR_PASSWORD secret) to unlock saving in this browser.

Saving commits to gelogrammer/My_DevOps_Playbook. Create a fine-grained token with access to only this repo andContents: Read and write, then paste it here. It is stored only in this browser.

src/content/docs/…