Linux Users and Groups

Create service accounts and grant precise group access.

  • linux user
  • adduser
  • usermod group
  • sudo user
  • service account

Linux Users and Groups

Create service accounts and grant precise group access.

Commands

CommandWhat it does
whoami and idCurrent user and groups
sudo adduser deployInteractive new user
usermod -aG group userAppend a group, keep existing
groups userVerify membership
chsh change shellChange login shell

Example

sudo adduser --disabled-password --gecos '' app
sudo usermod -aG docker app

FAQ

Why the -a flag with -G?

Without append, -G replaces all groups and can lock the user out of sudo - always append.

System user vs login user?

System flags create nologin service accounts for daemons.

Soalan Lazim

Why the -a flag with -G?
Without append, -G replaces all groups and can lock the user out of sudo - always append.
System user vs login user?
System flags create nologin service accounts for daemons.

Linux