👨‍💻
Mike's Notes
  • Introduction
  • MacOs Setup
    • System Preferences
    • Homebrew
      • Usage
    • iTerm
      • VIM
      • Tree
      • ZSH
    • Visual Studio Code
    • Git
    • SSH Keys
  • DevOps Knowledge
    • SRE
      • Scaling Reliably
        • Splitting a Monolith into Microservices
      • Troubleshooting Common Issues
      • Service Level Terminology
      • Toil
      • Monitoring
      • Release Engineering
      • Best Practices
      • On-Call
      • Alerting
    • Containers
      • Docker
        • Best Practices
          • Image Building
          • Docker Development
        • CLI Cheat Sheet
      • Container Orchestration
        • Kubernetes
          • Benefits
          • Cheat Sheet
          • Components
          • Pods
          • Workload Resources
          • Best Practices
    • Developer Portal 👨‍💻
      • Solution Overview 🎯
      • System Architecture 🏗️
      • Implementation Journey 🛠️
      • Cross-team Collaboration 🤝
      • Lessons & Future 🎓
    • Provisioning
      • Terraform
        • Installation
        • Usage
    • Configuration Management
      • Ansible
        • Benefits
        • Installation
    • Build Systems
      • Bazel
        • Features
  • Security
    • Secure Software Engineering
    • Core Concepts
    • Security Design Principles
    • Software Security Requirements
    • Compliance Standards and Policies
      • Sarbanes-Oxley (SOX)
      • HIPAA and HITECH
      • Payment Card Industry Data Security Standard (PCI-DSS)
      • General Data Protection Regulation (GDPR)
      • California Consumer Privacy Act (CCPA)
      • Federal Risk and Authorization Management Program (FedRAMP)
    • Privacy & Data
  • Linux Fundamentals
    • Introduction to Linux
    • Architecture
    • Server Administration
      • User / Groups
      • File Permissions
      • SSH
      • Process Management
    • Networking
      • Diagrams
      • Browser URL Example
      • Network Topologies
      • Signal Routing
      • DNS (Domain Name System)
      • SSL (Secure Sockets Layer)
      • TLS (Transport Layer Security)
  • System Design
    • Process
    • Kafka
      • Advanced Topics
    • URL Shortener
Powered by GitBook
On this page
  • Multi-User Operating Systems
  • User/Group Management
  • Important commands for managing users
  • Important commands for managing groups

Was this helpful?

  1. Linux Fundamentals
  2. Server Administration

User / Groups

PreviousServer AdministrationNextFile Permissions

Last updated 3 years ago

Was this helpful?

Multi-User Operating Systems

An operating system is considered as multi-user if it allows multiple people/users to use a computer and not affect each other's files and preferences. Linux based operating systems are multi-user in nature.

User/Group Management

  • Users in Linux has an associated user ID called UID attached to them.

  • A group is a collection of one or more users.

  • A group makes it easier to share permissions among a group of users.

  • Each group has a group ID called GID associated with it.

id command

id command can be used to find the uid and gid associated with an user. It also lists down the groups to which the user belongs to.

The uid and gid associated with the root user is 0.

A good way to find out the current user in Linux is to use the whoami command.

"root" user or superuser is the most privileged user with unrestricted access to all the resources on the system. It has UID 0

Important files associated with users/groups

/etc/passwd
Stores the user name, the uid, the gid, the home directory, the login shell etc

/etc/shadow

Stores the password associated with the users. Can only be accessed by super users

/etc/group

Stores information about different groups on the system

Important commands for managing users

Some of the commands which are used frequently to manage users/groups on Linux are following:

  • useradd - Creates a new user

  • passwd - Adds or modifies passwords for a user

  • usermod - Modifies attributes of a user (like home directory or shell)

    • One easy way of providing root access to users is to add them to a group which has permissions to run all the commands. "wheel" is a group in redhat Linux with such privileges. usermod -a -G wheel <user>

  • userdel - Deletes a user

  • su - Switch user

Important commands for managing groups

groupadd \<group_name>
Creates a new group

groupmod \<group_name>

Modifies attributes of a group

groupdel \<group_name>

Deletes a group

gpasswd \<group_name>

Modifies password for group