๐ฐ 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!
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
Theuseradd
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
- Example:
3. Password Management
Command:
passwd
Thepasswd
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
- Example:
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
- Example:
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
- Example:
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.
- Usage: Modify configuration files, such as
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
- Example:
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) andmv .folder folder
(to unhide)
- Command:
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.
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