๐Ÿ”ฐ Linux Training - Day 6-Linux User Management & Security ๐ŸŒŸ

๐ŸŒŸ Yesterday's Wow Moments in Linux User Management & Security ๐ŸŒŸ

Diving deeper into Linux fundamentals with user management and security was an incredible experience!

Linux User Management | A Complete Guide | NinjaOne

Some Wow Moments:

  • ๐Ÿ‘ฅ User Management Mastery: Gained control over user creation and password management using useradd, UID assignments, and security protocols.

  • ๐Ÿ”’ Security Deep Dive: Explored the shadow file for secure password storage, enhancing system security.

  • ๐Ÿ  Home Directory Essentials: Understood how the Home and /root directories create structured environments for users.

  • ๐Ÿ’ผ User Profiles: Configured profiles using the skeleton directory and practiced organizing workspaces by hiding/unhiding folders.

Topics Covered:

๐Ÿ”ฐ Linux Training - Day 6

  • ๐Ÿ“Œ UserAdd Command

  • ๐Ÿ“Œ UID (User ID) Setup

  • ๐Ÿ“Œ Password Management & Shadow File

  • ๐Ÿ“Œ Crypt Command for Encryption

  • ๐Ÿ“Œ Home Directory & /root Directory

  • ๐Ÿ“Œ Absolute Path Navigation

  • ๐Ÿ“Œ /etc Directory

  • ๐Ÿ“Œ Creating Users & Skeleton Directory

  • ๐Ÿ“Œ Folder Management & bashrc File Configuration

This session deepened my skills in Linux management and securityโ€”essential tools for any system admin! ๐Ÿš€

Here's an in-depth summary of the recent topics covered in Linux user management and system security, including a breakdown of essential commands.


๐Ÿ”ฐ Linux User Management & Security - In-Depth

1. User Management Fundamentals

  • Command: useradd
    The useradd command creates a new user account. When executed, it creates a user directory and assigns a unique user ID (UID).

    • Example: sudo useradd username

    • Flags:

      • -m: Creates a home directory if it doesnโ€™t exist.

      • -d: Defines a custom home directory path.

      • -s: Specifies a login shell for the user.

2. Setting Up UIDs (User IDs)

  • Each Linux user has a unique UID. By default, Linux assigns UIDs automatically, but you can manually set them with the -u flag.

    • Example: sudo useradd -u 1050 username

3. Password Management

  • Command: passwd
    The passwd command sets or updates a userโ€™s password. Only the root user or an authorized administrator can reset passwords for other users.

    • Example: sudo passwd username

4. The Shadow File

  • Located at /etc/shadow, the shadow file securely stores user passwords in an encrypted format. Access to this file is restricted to enhance security.

    • Command: sudo cat /etc/shadow

    • Usage: Only root can view or modify this file, which stores hashed passwords and expiration details.

5. Crypt Command for Encryption

  • Command: crypt (available on some systems)
    Encrypts data or strings using various algorithms. However, this command might not be pre-installed on all Linux systems, as itโ€™s specific to some distributions.

    • Example: echo "password" | crypt

6. Home Directory Essentials

  • Directory: /home
    Each user has a dedicated directory within /home. For the root user, the default directory is /root.

    • Usage: Provides isolated workspaces and personal storage for each user.

7. Root Directory (/root)

  • The root userโ€™s exclusive directory, /root, contains the adminโ€™s files and configurations, accessible only with elevated permissions.

8. Absolute Path Navigation

  • Absolute paths start from the root (/) directory and provide full paths for navigating files and directories.

    • Example: /home/username/documents/file.txt

9. /etc Directory

  • The /etc directory is where Linux stores all configuration files for system applications and services.

    • Usage: Modify configuration files, such as /etc/passwd or /etc/shadow, for user management.

10. Creating Users with Skeleton Directory

  • Command: useradd with -k option
    The skeleton directory (/etc/skel) provides default files (like .bashrc) that are copied to a new user's home directory upon creation.

    • Example: sudo useradd -m -k /etc/skel username

11. Hiding and Unhiding Folders

  • Prefixing a folder with a dot (.) hides it. This convention allows users to organize files without cluttering their workspace.

    • Command: mv folder .folder (to hide) and mv .folder folder (to unhide)

12. Configuring the .bashrc File

  • File: .bashrc
    This script runs each time a new terminal session opens. Users can customize it to add aliases, set environment variables, and define prompt styles.

    • Command: nano ~/.bashrc

    • Example: Adding alias ll='ls -al' for a quick list-all command.

Additional Commands Overview

  • Listing Processes: ps aux (to list all active processes)

  • Foreground & Background Tasks:

    • Ctrl + Z: Suspend a task.

    • bg: Move the suspended task to the background.

    • fg: Bring a background task to the foreground.

  • Checking Connectivity: ping (e.g., ping google.com to test network status).

  • File Creation:

    • mkdir foldername: Create a new directory.

    • touch filename: Create an empty file.

0
Subscribe to my newsletter

Read articles from MUKESH KUMAR MAHTO directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

MUKESH KUMAR MAHTO
MUKESH KUMAR MAHTO