Linux/Unix Tutorial
Estimated reading: 4 minutes 272 views

Linux/Unix: User, Group & Security Management – Manage Accounts & Secure Your System

Introduction – Control Access and Enforce Security in Linux

Linux is built around the principle of multi-user environments and permission-based access. Whether you’re administering a shared server or setting up a personal workstation, knowing how to manage users, groups, authentication, and security tools is essential for system safety and structure.

In this guide, you’ll learn:

  • How to create, modify, and manage users and groups
  • How to enforce authentication and privilege control using sudo, passwd, and su
  • How to view system identity and uptime
  • How to use Linux tools for hardening and access restrictions

Topics Covered

Category Description
User & Group ManagementCreate and manage users, groups, and IDs
Authentication & PrivilegesSecure access using passwords, sudo, and session management
System Identity ToolsView hostname, kernel, and uptime data
Basic Security ToolsUse firewalls and attribute tools for basic Linux system protection

Linux/Unix: User & Group Management

Add and Manage Users

sudo useradd john
sudo passwd john

Adds a new user and sets their password.


Modify Existing Users

sudo usermod -aG sudo john     # Add user to sudo group
sudo usermod -l newname oldname

Modify group access or rename users.


Group Management

groups john             # List groups
sudo groupadd editors   # Create group
sudo usermod -aG editors john

Identity Verification

id john                 # Show UID, GID, group membership
whoami                  # Current username

Linux/Unix: Authentication (passwd, su, sudo)

Set/Change Passwords

passwd john

Only root can reset others’ passwords.


su – Switch User Temporarily

su - john

Switches to another user’s session.


sudo – Execute with Elevated Privileges

sudo apt update

Allows limited admin access without logging in as root.


Configure /etc/sudoers

Use:

sudo visudo

Add users to grant specific or full sudo rights safely.


Linux/Unix: System Info (uname, hostname, uptime)

View System Identity

uname -a            # Kernel info
hostname            # Hostname
uptime              # System load and uptime

Quickly audit host details and runtime.


Linux/Unix: Basic Security Tools (chattr, semanage, ufw, firewalld)

chattr – File Attribute Control

sudo chattr +i file.txt     # Make file immutable
sudo chattr -i file.txt

Prevents even root from modifying/deleting files unless reversed.


semanage – SELinux Policy Tool

semanage fcontext -l | grep ssh

Used with SELinux-enabled systems for context management.


ufw – Uncomplicated Firewall

sudo ufw enable
sudo ufw allow 22/tcp

Simple firewall setup (ideal for Ubuntu/Debian users).


firewalld – Dynamic Firewall Manager

sudo systemctl start firewalld
sudo firewall-cmd --add-service=http --permanent
sudo firewall-cmd --reload

Used on CentOS, Fedora, and RHEL for zone-based firewalling.


Summary – Recap & Next Steps

User, group, and security management form the backbone of Linux system control. Whether you’re configuring multi-user access or applying security hardening techniques, these tools help enforce accountability, permissions, and network safety.

Key Takeaways:

  • Use useradd, usermod, and groupadd for account management
  • Configure sudo carefully to restrict elevated access
  • Use ufw or firewalld to control network access
  • Make sensitive files immutable with chattr

Real-World Applications:

  • Manage user permissions in hosting or development servers
  • Protect sensitive configuration files from tampering
  • Implement secure sudo policies for team environments
  • Block unwanted traffic via firewall rules

Frequently Asked Questions

What’s the difference between su and sudo?
su switches to another user shell; sudo runs a command with another user’s (usually root’s) privileges.


How do I give a user sudo access?
Add them to the sudo group or configure rules via visudo.


Can I delete a user safely without removing their files?
Yes:

sudo userdel username       # Keeps home directory
sudo userdel -r username    # Removes home too

How do I prevent accidental file deletion?
Use:

sudo chattr +i important.conf

What’s the best beginner-friendly firewall tool?
Use ufw on Ubuntu/Debian, and firewalld on RHEL-based systems.


Share Now :
Share

πŸ‘₯ Linux/Unix: User, Group & Security Management

Or Copy Link

CONTENTS
Scroll to Top