<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shweta Thikekar</title>
    <description>The latest articles on DEV Community by Shweta Thikekar (@shweta_thikekar).</description>
    <link>https://dev.to/shweta_thikekar</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2596273%2F98313475-2ff5-437b-981e-f8592ffa5edb.jpeg</url>
      <title>DEV Community: Shweta Thikekar</title>
      <link>https://dev.to/shweta_thikekar</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shweta_thikekar"/>
    <language>en</language>
    <item>
      <title>From Simple to Secure: Understanding Normal, Multi-Stage, and Distroless Docker Builds</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Tue, 04 Feb 2025 14:49:05 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/from-simple-to-secure-understanding-normal-multi-stage-and-distroless-docker-builds-ell</link>
      <guid>https://dev.to/shweta_thikekar/from-simple-to-secure-understanding-normal-multi-stage-and-distroless-docker-builds-ell</guid>
      <description>&lt;p&gt;When building Docker images, choosing the right build strategy can significantly affect the size, security, and performance of your containers. The three common strategies are Normal Build, Multi-Stage Build, and Distroless Build. Each has its strengths and trade-offs depending on your needs. Let’s dive into when and why you might choose each one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Normal Build&lt;/strong&gt;&lt;br&gt;
In a normal Docker build, we start by using a base image, add our application code, and install dependencies. This results in a container that contains both your application and the full operating system or environment that comes with the base image.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Python Script (hello.py):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello World")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Dockerfile (Normal Build):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Use the official Python image
FROM python:3.9

# Set the working directory inside the container
WORKDIR /app

# Copy the Python script into the container
COPY hello.py .

# Run the Python script
CMD ["python", "hello.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this case, the container will include Python and the full Python runtime environment. This results in a larger image since it includes both the operating system and Python libraries.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build and Run:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t python-hello-world .
docker run python-hello-world
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;&lt;strong&gt;2. Multi-Stage Build&lt;/strong&gt;&lt;br&gt;
A multi-stage build strategy allows you to use one image to build the application and another, lighter image to run it. This helps reduce the final image size by only copying over the necessary artifacts, such as compiled code or installed dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Python Script (hello.py):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello World")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Dockerfile (Multi-Stage Build):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Stage 1: Build environment (with full dependencies)
FROM python:3.9 AS build-env

# Set the working directory inside the container
WORKDIR /app

# Copy the Python script into the container
COPY hello.py .

# Install any dependencies (optional)
RUN pip install --no-cache-dir requests

# Stage 2: Runtime environment (lighter base image)
FROM python:3.9-slim

# Set the working directory inside the container
WORKDIR /app

# Copy only the necessary files from the build-env stage
COPY --from=build-env /app /app

# Run the Python script
CMD ["python", "hello.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Stage 1, the python:3.9 image is used to build the app, install dependencies, and prepare everything.&lt;/p&gt;

&lt;p&gt;In Stage 2, the dependencies and app files are copied into a much smaller image, python:3.9-slim, which has a minimal footprint and only includes the essentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build and Run:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t python-hello-world-multi .
docker run python-hello-world-multi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By separating the build and runtime environments, you can drastically reduce the size of the final image.&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3. Distroless Build&lt;/strong&gt;&lt;br&gt;
A Distroless Build takes minimalism to the extreme. It only includes the application and the necessary runtime libraries, leaving out everything else — including the operating system, shell, package manager, or debugging tools. Distroless images focus on security and performance, but come with trade-offs: debugging and troubleshooting become more difficult due to the absence of shell access.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Python Script (hello.py):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;print("Hello World")
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Dockerfile (Distroless Build):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Stage 1: Build environment
FROM python:3.9 AS build-env

# Set the working directory inside the container
WORKDIR /app

# Copy the Python script into the container
COPY hello.py .

# Install any dependencies (optional)
RUN pip install --no-cache-dir requests

# Stage 2: Final runtime image (distroless)
FROM gcr.io/distroless/python3

# Set the working directory inside the container
WORKDIR /app

# Copy only the necessary files from the build-env stage
COPY --from=build-env /app /app

# Run the Python script
CMD ["python", "hello.py"]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;How It Works:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Stage 1, the full python:3.9 image is used to build the app and install any dependencies.&lt;/p&gt;

&lt;p&gt;In Stage 2, the gcr.io/distroless/python3 image is used, which only contains Python and essential runtime libraries. No shell, no debugging tools, just the application and its dependencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Build and Run:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker build -t python-hello-world-distroless .
docker run python-hello-world-distroless
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because the distroless image is minimal, it is both smaller and more secure. However, troubleshooting becomes much harder without tools like bash or curl.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsqohki3jcvg62v1y8g9t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsqohki3jcvg62v1y8g9t.png" alt="Image description" width="800" height="445"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The build strategy you choose for your Docker image depends on the nature of your application and your specific needs. If you’re working on a simple app and need a straightforward build, a Normal Build might be the best choice. For more complex applications with dependencies or compilation steps, a Multi-Stage Build helps reduce the final image size while still providing flexibility during the build process. Finally, for production environments focused on security and efficiency, a Distroless Build offers a minimal, secure, and optimized solution, though at the cost of some debugging convenience.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Firewall Basics: How to Secure Your Linux Server with Firewalld</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Mon, 27 Jan 2025 16:27:38 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/firewall-basics-how-to-secure-your-linux-server-with-firewalld-4j0j</link>
      <guid>https://dev.to/shweta_thikekar/firewall-basics-how-to-secure-your-linux-server-with-firewalld-4j0j</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsl6ypsgao1je22ilzi4x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fsl6ypsgao1je22ilzi4x.png" alt="Image description" width="265" height="148"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In today’s interconnected world, securing your server from unauthorized access is a critical part of system administration. A firewall acts as the first line of defense by controlling incoming and outgoing network traffic based on predetermined security rules.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Linux servers provide robust tools to configure and manage firewalls, with firewalld being one of the most popular options for dynamic firewall management. Although iptables is another powerful tool for managing firewall rules, this article will focus on firewalld for its simplicity and ease of use. Let’s dive into the basics and learn how to implement a firewall on a Linux server.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What is a Firewall?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A firewall is a network security system that monitors and controls traffic based on security rules. It can be hardware-based, software-based, or a combination of both. Firewalls help:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Prevent unauthorized access to your system.&lt;/li&gt;
&lt;li&gt;Block malicious traffic.&lt;/li&gt;
&lt;li&gt;Allow safe communication by defining specific rules for traffic flow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Understanding Firewalld&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firewalld is a firewall management tool that supports dynamic rule changes without disrupting existing network connections. It uses zones to apply different sets of rules based on the trust level of a network interface.&lt;br&gt;
Some key components of firewalld:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Zones: Define trust levels for network interfaces (e.g., public, private, home).&lt;/li&gt;
&lt;li&gt;Services: Predefined rules for common applications (e.g., HTTP, SSH).&lt;/li&gt;
&lt;li&gt;Ports: Specific network ports you can open or close.&lt;/li&gt;
&lt;li&gt;XML Configurations: Define custom services and rules in XML format.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Installing and Enabling Firewalld&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Most Linux distributions come with firewalld pre-installed. If not, you can install it using your package manager.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Steps to Install Firewalld:Install Firewalld:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt install firewalld  # For Ubuntu/Debian
sudo yum install firewalld  # For CentOS/Red HatStart and Enable 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Firewalld:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl start firewalld
sudo systemctl enable firewalld
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Check the Status:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo systemctl status firewalld
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Basic Firewalld Commands&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are some essential commands to manage your firewall:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Check Active Zones:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To view the active zones and their associated interfaces:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --get-active-zones
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. List All Rules for a Zone:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To list the rules of a specific zone (e.g., public):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --zone=public --list-all
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;3. Add a Port to a Zone:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To allow traffic on a specific port (e.g., 8080 for HTTP):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --zone=public --add-port=8080/tcp --permanent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The --permanent flag ensures the change persists after a reboot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Add a Service to a Zone:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To allow a predefined service (e.g., SSH):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --zone=public --add-service=ssh --permanent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;5. Remove a Port or Service:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To remove a port or service from a zone:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --zone=public --remove-port=8080/tcp --permanent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --zone=public --remove-service=ssh --permanent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;6. Reload the Firewall:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Apply changes by reloading:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using XML Files for Custom Services&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Firewalld allows you to create custom services using XML files. These files are located in the &lt;code&gt;/etc/firewalld/services/&lt;/code&gt; directory. &lt;/p&gt;

&lt;p&gt;For example, to create a custom service for an application running on port 5000:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a New Service File:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/firewalld/services/myapp.xml&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Define the Service in XML:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;
&amp;lt;service&amp;gt;
    &amp;lt;short&amp;gt;MyApp&amp;lt;/short&amp;gt;
    &amp;lt;description&amp;gt;Custom service for MyApp&amp;lt;/description&amp;gt;
    &amp;lt;port protocol="tcp" port="5000"/&amp;gt;
&amp;lt;/service&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Reload Firewalld and Add the Service:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --reload
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --zone=public --add-service=myapp --permanent
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Verifying Rules&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To ensure your rules are working:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;List Open Ports:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo firewall-cmd --list-ports
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Test Connectivity:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use tools like &lt;code&gt;curl&lt;/code&gt; or &lt;code&gt;telnet&lt;/code&gt; to test if the port/service is accessible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Configuring a firewall is a foundational step in securing any Linux server. Firewalld offers an intuitive and flexible approach for managing firewall rules, making it easier for administrators to define and modify security policies on the fly. You can customize the firewall to suit your security needs by understanding zones, services, and ports. While this guide focused on firewalld, tools like iptables provide additional depth for advanced configurations. Ensuring proper firewall setup not only enhances your server's security but also gives you greater control over network traffic, helping to safeguard your systems effectively.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to Easily Recover the Root Password in RHEL/CentOS 8: A Step-by-Step Guide</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Sun, 26 Jan 2025 12:00:44 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/how-to-easily-recover-the-root-password-in-rhelcentos-8-a-step-by-step-guide-3lej</link>
      <guid>https://dev.to/shweta_thikekar/how-to-easily-recover-the-root-password-in-rhelcentos-8-a-step-by-step-guide-3lej</guid>
      <description>&lt;p&gt;In CentOS 8, like most Linux distributions, the root password is critical for performing administrative tasks. If you've forgotten your root password or need to reset it for any reason, it is possible to recover it with some straightforward steps. Here's a guide on how to recover the root password in CentOS 8.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Physical access to the machine (or virtual machine console).&lt;/li&gt;
&lt;li&gt;The ability to reboot the system and modify boot parameters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Steps to Recover the Root Password:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Step 1: Reboot into GRUB Menu&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reboot the System:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Start by rebooting the CentOS 8 system. This can usually be done from the terminal with the reboot command, or by pressing the reset button if you're on a physical machine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Access the GRUB Menu:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When the system begins to boot, immediately press the &lt;code&gt;Esc&lt;/code&gt; key or &lt;code&gt;Shift key&lt;/code&gt; (depending on your system's configuration) to access the GRUB boot loader screen. This is typically displayed briefly at the start of the boot process.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Step 2: Modify GRUB Boot Parameters&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Edit GRUB Configuration:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once the GRUB menu appears, highlight the boot entry for CentOS (usually the default one) using the arrow keys.
Press the &lt;code&gt;e&lt;/code&gt; key to edit the boot parameters.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Modify the Boot Command:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the GRUB editor, locate the line that starts with linux or linux16 (depending on your system).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;At the end of this line, add the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;rd.break
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This tells the system to break into an emergency shell before mounting the root filesystem.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Boot into Single User Mode:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After adding &lt;code&gt;rd.break&lt;/code&gt;, press &lt;code&gt;Ctrl + X&lt;/code&gt; to boot with these modified parameters.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;&lt;strong&gt;Step 3: Reset the Root Password&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Access the Emergency Shell:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The system will boot into a minimal environment with a root shell prompt, typically in a switch_root directory (mounted as &lt;code&gt;/sysroot&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Remount the Root Filesystem:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The root filesystem is mounted as read-only by default. You need to remount it as read-write to make changes:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mount -o remount,rw /sysroot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Chroot into the System:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now, change root (chroot) into the &lt;code&gt;/sysroot&lt;/code&gt; directory so that you can interact with your system as if you were in a normal environment:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chroot /sysroot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Reset the Root Password:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You can now reset the root password using the passwd command:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;passwd root
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Enter a new password for the root user when prompted. Make sure the password meets your system’s security requirements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Relabel SELinux Contexts:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If SELinux is enabled on your system, it's important to relabel the filesystem after resetting the password to avoid any potential issues:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch /.autorelabel
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;&lt;strong&gt;Step 4: Reboot the System&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exit and Reboot:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exit the chroot environment:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Reboot the system:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;reboot
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Your system will now reboot normally, and SELinux will automatically relabel the filesystem on startup.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Login with the New Root Password:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Once the system has rebooted, you should be able to log in with the new root password.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Troubleshooting Tips:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you encounter a system that doesn't show the GRUB menu: You may need to press &lt;code&gt;Esc&lt;/code&gt; or &lt;code&gt;Shift&lt;/code&gt; more quickly, or adjust your bootloader settings in BIOS/UEFI to allow you to see the GRUB menu.&lt;/li&gt;
&lt;li&gt;If the system doesn't boot after modifying boot parameters: Ensure you typed the &lt;code&gt;rd.break&lt;/code&gt; correctly and that there are no extra spaces or typos.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Recovering the root password in CentOS 8 is relatively simple as long as you have physical access to the machine and can modify the boot parameters. By entering single-user mode and resetting the root password through the emergency shell, you can regain control of your system without losing data. Always ensure that your root password is stored securely to prevent future issues.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
    </item>
    <item>
      <title>Nginx Simplified: Technical Insights with Real-World Analogies</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Mon, 13 Jan 2025 15:25:43 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/nginx-simplified-technical-insights-with-real-world-analogies-h7d</link>
      <guid>https://dev.to/shweta_thikekar/nginx-simplified-technical-insights-with-real-world-analogies-h7d</guid>
      <description>&lt;h3&gt;
  
  
  &lt;strong&gt;What is Nginx?&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Nginx is an open-source, high-performance web server that also acts as a reverse proxy, load balancer, and HTTP cache. It’s designed to handle a high number of concurrent connections efficiently.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imagine a busy restaurant:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Web Server Role:&lt;/strong&gt; Nginx is the chef, serving meals (webpages) directly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reverse Proxy Role:&lt;/strong&gt; It’s the receptionist, passing orders (user requests) to the right chef in the kitchen.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Load Balancer Role:&lt;/strong&gt; It’s the manager, ensuring chefs share the workload evenly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cache Role:&lt;/strong&gt; It’s the fridge, keeping popular dishes ready to serve quickly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Installing Nginx&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Nginx runs on Linux. Let’s install it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ubuntu/Debian:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo apt update
sudo apt install nginx -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;CentOS/RHEL:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo yum install nginx -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;br&gt;
Installing Nginx is like building the restaurant’s infrastructure, setting up tables, and opening for business.&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Basic Configuration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The main configuration file is:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;/etc/nginx/nginx.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key parts:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;http {}:&lt;/strong&gt; Handles web traffic configuration.&lt;br&gt;
&lt;strong&gt;server {}:&lt;/strong&gt; Defines how to respond to requests for a domain.&lt;br&gt;
&lt;strong&gt;location {}:&lt;/strong&gt; Specifies rules for URLs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen 80;
    server_name example.com;

    location / {
        root /var/www/html;
        index index.html;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of nginx.conf as the restaurant’s recipe book:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;http: General guidelines for all recipes.&lt;/li&gt;
&lt;li&gt;server: Recipe for a specific dish (domain).&lt;/li&gt;
&lt;li&gt;location: Special instructions for certain ingredients (URLs).&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Hosting a Website&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Go to the web root directory:&lt;br&gt;
&lt;code&gt;cd /var/www/html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Create an index.html file:&lt;br&gt;
&lt;code&gt;echo "&amp;lt;h1&amp;gt;Welcome to Nginx!&amp;lt;/h1&amp;gt;" | sudo tee index.html&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Restart Nginx:&lt;br&gt;
&lt;code&gt;sudo systemctl restart nginx&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Open your browser and go to &lt;code&gt;http://localhost&lt;/code&gt; to see your page.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is like creating the restaurant’s menu (website). Now anyone can come and order food (visit your site).&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;strong&gt;Reverse Proxy&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A reverse proxy forwards client requests to backend servers. It hides the servers from the users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Configuration:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen 80;
    server_name myproxy.com;

    location / {
        proxy_pass http://127.0.0.1:5000;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Imagine the receptionist (Nginx) doesn’t cook but takes orders and gives them to the kitchen (backend servers). The customer only interacts with the receptionist.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Load Balancing&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Nginx distributes requests among multiple backend servers to balance the load.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example Configuration:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;http {
    upstream backend {
        server 192.168.1.10;
        server 192.168.1.11;
    }

    server {
        listen 80;
        server_name myloadbalancer.com;

        location / {
            proxy_pass http://backend;
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is like having multiple chefs in the kitchen. The manager (Nginx) assigns each chef an equal number of orders.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Caching&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Caching stores frequently requested content to serve it faster.&lt;/p&gt;

&lt;p&gt;Enable Caching:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;proxy_cache_path /data/nginx/cache levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=60m use_temp_path=off;

server {
    location / {
        proxy_cache my_cache;
        proxy_pass http://backend;
        add_header X-Cache-Status $upstream_cache_status;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Caching is like prepping popular dishes ahead of time so they’re ready to serve instantly.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;HTTPS with SSL&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Enable secure communication with HTTPS using SSL certificates.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Generate a certificate:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/nginx-selfsigned.key -out /etc/ssl/certs/nginx-selfsigned.crt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Update Nginx:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;server {
    listen 443 ssl;
    server_name mywebsite.com;

    ssl_certificate /etc/ssl/certs/nginx-selfsigned.crt;
    ssl_certificate_key /etc/ssl/private/nginx-selfsigned.key;

    location / {
        root /var/www/html;
        index index.html;
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;HTTPS is like adding a security guard to the restaurant, ensuring all communication is safe and encrypted.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Debugging and Logs&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Technical:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Check logs for debugging:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Access logs: /var/log/nginx/access.log
Error logs: /var/log/nginx/error.log
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Test configurations:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nginx -t&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Analogy:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Logs are like feedback cards from customers. They help you know if something is going wrong.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Load Balancing Algorithms in Nginx&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Nginx supports multiple algorithms for distributing traffic among backend servers. The choice of algorithm depends on the scenario and configuration. Here's a list of commonly used load balancing algorithms:&lt;/p&gt;

&lt;p&gt;Load Balancing Algorithms in Nginx&lt;br&gt;
Nginx supports multiple algorithms for distributing traffic among backend servers. The choice of algorithm depends on the scenario and configuration. Here's a list of commonly used load balancing algorithms:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Round Robin (Default)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How it works:&lt;/strong&gt; Requests are distributed sequentially to each backend server in turn.&lt;br&gt;
&lt;strong&gt;Use case:&lt;/strong&gt; Best for equally capable backend servers with no need for complex logic.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;upstream backend {
    server 192.168.1.10;
    server 192.168.1.11;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Least Connections&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;How it works:&lt;/strong&gt; Sends requests to the server with the least number of active connections.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. IP Hash&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;How it works:&lt;/strong&gt; Distributes requests based on the client’s IP address. Ensures a client is always routed to the same server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Generic Hash&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;How it works:&lt;/strong&gt; Routes requests based on a specified key (e.g., a URL, cookie, or header).&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Nginx is a powerful and versatile tool, capable of handling complex web server, proxy, load balancing, and caching needs with ease. Its event-driven architecture makes it an ideal choice for high-performance environments, and its flexibility allows it to cater to varied use cases, from hosting a simple static website to serving as a reverse proxy for microservices.&lt;/p&gt;

&lt;p&gt;By mastering its features, such as load balancing algorithms, HTTPS setup, and caching mechanisms, you can optimize your application for scalability, security, and speed. Whether you're a beginner starting with installation or an experienced DevOps engineer diving into advanced configurations, Nginx offers endless possibilities for enhancing your infrastructure.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>nginx</category>
      <category>devops</category>
      <category>webserver</category>
    </item>
    <item>
      <title>Mastering Linux File Systems: Everything You Need to Know About Symlinks and Hard Links</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Mon, 06 Jan 2025 16:46:12 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/mastering-linux-file-systems-everything-you-need-to-know-about-symlinks-and-hard-links-khg</link>
      <guid>https://dev.to/shweta_thikekar/mastering-linux-file-systems-everything-you-need-to-know-about-symlinks-and-hard-links-khg</guid>
      <description>&lt;h4&gt;
  
  
  &lt;strong&gt;What is file system?&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A file system in Linux is the method used to organize and store data on storage devices such as hard drives, SSDs, or USB drives. It defines how files are named, stored, accessed, and managed on the disk. The Linux file system is a hierarchical structure where everything is treated as a file, whether it’s data, directories, devices, or even processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hierarchical Structure:&lt;/strong&gt; The file system is organized like a tree, starting from the root directory &lt;code&gt;/&lt;/code&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;strong&gt;Key Concepts of the Linux File System&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;&lt;strong&gt;1. Everything is a File:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In Linux, everything is treated as a file, whether a text document, a directory, a device, or a process.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Regular files: Text, binaries, images, etc.&lt;/li&gt;
&lt;li&gt;Directories: Special files that store references to other files.&lt;/li&gt;
&lt;li&gt;Devices: Represented as files in /dev (e.g., /dev/sda for a hard drive).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. Hierarchical Directory Structure:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The Linux file system starts with a single root directory /.&lt;/li&gt;
&lt;li&gt;All other directories and files branch out from this root in a tree-like structure.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example: &lt;code&gt;/home/user/Documents/file.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Important Linux Directories&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpj69j5a78fp78thfgn4b.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpj69j5a78fp78thfgn4b.png" alt="Linux Directories" width="657" height="495"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. File Types:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Regular files: Contain data (e.g., /etc/hosts).&lt;/li&gt;
&lt;li&gt;Directories: Store files and other directories.&lt;/li&gt;
&lt;li&gt;Symbolic links: Pointers to other files or directories.&lt;/li&gt;
&lt;li&gt;Device files: Interface to hardware (e.g., /dev/null).&lt;/li&gt;
&lt;li&gt;Sockets and pipes: Used for inter-process communication.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. File System Types:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwnmuywhh4ck8rjurxzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuwnmuywhh4ck8rjurxzk.png" alt="Image description" width="800" height="216"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Special Symbols:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.&lt;/code&gt;: Current directory.&lt;br&gt;
&lt;code&gt;..&lt;/code&gt;: Parent directory.&lt;br&gt;
&lt;code&gt;~&lt;/code&gt;: Home directory of the current user.&lt;/p&gt;


&lt;h4&gt;
  
  
  &lt;strong&gt;Symlinks&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A symlink (symbolic link) is a special type of file that points to another file or directory. A symlink is like a shortcut pointing to a file or folder. The difference between absolute and relative symlinks is how they point to the target. There are two types of symlinks:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Symlinks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Absolute Symlink&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An absolute symlink uses the full path to point to the target file or folder.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If your target file is at &lt;code&gt;/home/shweta/test/file.txt&lt;/code&gt;, the symlink will remember this full path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Think of it as:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Giving someone your complete home address (e.g., "123 Main Street, Mumbai") to reach you.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to Create It:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s /home/shweta/test/file.txt /home/shweta/shortcut.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Relative Symlink&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A relative symlink uses a shorter path, relative to the symlink's location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If you're in &lt;code&gt;/home/shweta/&lt;/code&gt; and want to link to &lt;code&gt;test/file.txt&lt;/code&gt;, the symlink will only remember "&lt;code&gt;test/file.txt&lt;/code&gt;", not the full path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Think of it as:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Telling someone how to reach you from where they currently are (e.g., "Just walk 2 blocks to Main Street").&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to Create It:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s test/file.txt relative_shortcut.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Difference&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Absolute symlink: Always works because it has the full address.&lt;/li&gt;
&lt;li&gt;Relative symlink: Works only if you don't move the symlink or its target around.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Practice Example&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Absolute Symlink:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s /etc/passwd absolute_link.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a shortcut absolute_link.txt to &lt;code&gt;/etc/passwd&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create Relative Symlink:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s ../test/file.txt relative_link.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a shortcut &lt;code&gt;relative_link.txt&lt;/code&gt; to a file relative to the symlink's location.&lt;/p&gt;

&lt;p&gt;A symlink breaks when it points to a file or directory that no longer exists or cannot be found. This happens because the symlink is just a pointer; it doesn’t store the content itself. Here's how and why symlinks break:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Does a Symlink Break?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Target is Deleted:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the file or directory the symlink points to is removed, the symlink has nothing to reference.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s /home/shweta/test/file.txt shortcut.txt&lt;/code&gt;&lt;br&gt;
&lt;code&gt;rm /home/shweta/test/file.txt&lt;/code&gt;  # Deletes the target file&lt;br&gt;
Now, shortcut.txt is broken.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Target is Moved or Renamed:&lt;/strong&gt;&lt;br&gt;
-If the target file or folder is moved or renamed, the symlink’s pointer becomes invalid.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s /home/shweta/test/file.txt shortcut.txt&lt;/code&gt;&lt;br&gt;
&lt;code&gt;mv /home/shweta/test/file.txt /home/shweta/test/renamed_file.txt&lt;/code&gt;&lt;br&gt;
&lt;code&gt;shortcut.txt&lt;/code&gt; still points to &lt;code&gt;/home/shweta/test/file.txt&lt;/code&gt;, which no longer exists.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Relative Symlink Context Changes:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If a relative symlink is moved to a new location, it might not align correctly with its target anymore.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -s ../file.txt relative_link.txt&lt;/code&gt;&lt;br&gt;
&lt;code&gt;mv relative_link.txt /some/other/path/&lt;/code&gt;&lt;br&gt;
The &lt;code&gt;relative_link.txt&lt;/code&gt; will now break because its target is calculated based on its original location.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Fix a Broken Symlink&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Recreate the Target File/Folder:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If the target was deleted, recreate it at the original path.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Update the Symlink to a New Target:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;ln -sf&lt;/code&gt; command to update the symlink to a valid target.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;ln -sf /new/path/to/file.txt shortcut.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Delete the Broken Symlink:&lt;/strong&gt;&lt;br&gt;
If it’s no longer needed, remove it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;rm shortcut.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pro Tip to Avoid Broken Symlinks&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use absolute symlinks when the target is unlikely to move or when reliability is critical.&lt;/li&gt;
&lt;li&gt;Use relative symlinks only for files/folders that are part of the same structure and will move together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Absolute Path Symlink&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;How it works: Points to the full, unchanging path of the target file.&lt;/p&gt;

&lt;p&gt;Behavior when moved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shortcut (symlink) moved: It does not break because the symlink still references the target's full path.&lt;/li&gt;
&lt;li&gt;Target moved: It breaks because the absolute path to the target is no longer valid.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Relative Path Symlink&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;How it works: Points to the target relative to the symlink’s location.&lt;/p&gt;

&lt;p&gt;Behavior when moved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shortcut (symlink) moved: It breaks because the relative path calculation becomes invalid in the new location.&lt;/li&gt;
&lt;li&gt;Target moved: It breaks because the symlink’s relative reference doesn’t update with the target's new location.&lt;/li&gt;
&lt;/ul&gt;


&lt;h4&gt;
  
  
  &lt;strong&gt;Hard Links&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;A hard link is a secondary name for a file that refers directly to the same inode (a file system data structure). Unlike symlinks, hard links are not pointers but direct references to the actual data of a file.&lt;/p&gt;

&lt;p&gt;Let’s break it down with simple explanations, examples, and practical tips.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key Characteristics of Hard Links&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Shared Inode:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard links share the same inode as the original file.&lt;br&gt;
Inodes store metadata (e.g., file permissions, size, timestamps) and point to the actual data blocks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Independent of the Original File's Path:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if the original file is deleted, the data remains accessible through its hard link(s).&lt;br&gt;
The link count (seen in ls -l) must drop to zero for the file to be truly deleted.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Cannot Span File Systems:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard links must exist within the same filesystem because they reference inodes directly.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Directories Are Excluded:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard links cannot be created for directories due to filesystem consistency and potential looping issues.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How to Create a Hard Link&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Command:&lt;br&gt;
&lt;code&gt;ln &amp;lt;target_file&amp;gt; &amp;lt;hard_link&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch original.txt           # Create a file
ln original.txt link.txt     # Create a hard link
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This creates a hard link link.txt that points to the same inode as original.txt.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Checking Hard Links&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Use the ls -li command to view inode numbers:&lt;br&gt;
&lt;code&gt;ls -li&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Example output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;256700 -rw-r--r--  2 user group 1024 Dec 28 10:00 original.txt  
256700 -rw-r--r--  2 user group 1024 Dec 28 10:00 link.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both files share the same inode (256700), confirming they are hard links.&lt;br&gt;
The second column (2) shows the number of links to the file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Behavior of Hard Links&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File Deletion:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If original.txt is deleted, the file content remains accessible via link.txt because the data blocks are still referenced.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Modifications:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Changes made to either the original file or the hard link reflect in the other since they point to the same data blocks.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Storage:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard links consume no extra disk space for the file’s data, only a directory entry.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Differences Between Hard Links and Symlinks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxw8q4ftxtyad97088t5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbxw8q4ftxtyad97088t5.png" alt="Image description" width="800" height="153"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use Cases of Hard Links&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preserve Data:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use hard links to ensure file data is accessible even if the original file is accidentally deleted.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Efficient Backups:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard links avoid duplicating file data, saving space in backup systems.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Organizing Files:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Use multiple names for the same file in different directories without using additional storage.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Breaking Scenarios&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Unlike symlinks, hard links are robust against most changes. However, there are a few limitations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;File System Boundaries:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You cannot create hard links across filesystems (e.g., linking a file on /home to /tmp).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Root-Level Management:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hard links are harder to identify and manage because they share inodes invisibly to users.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practice Example&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a Hard Link:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ln /home/shweta/notes.txt /home/shweta/backup_notes.txt&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;This creates a hard link named backup_notes.txt pointing to notes.txt.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Verify:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;ls -li /home/shweta/notes.txt /home/shweta/backup_notes.txt&lt;/code&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Output:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;128734 -rw-r--r-- 2 shweta group 2048 Dec 28 10:00 notes.txt  
128734 -rw-r--r-- 2 shweta group 2048 Dec 28 10:00 backup_notes.txt
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
Understanding the Linux file system is fundamental for efficient data management and system administration. The hierarchical structure and features like symlinks and hard links offer flexibility and robustness in handling files and directories. By grasping the differences between absolute and relative symlinks and the advantages of hard links, you can enhance your file organization, create reliable shortcuts, and safeguard critical data. Whether you're a beginner exploring Linux or a seasoned professional, mastering these concepts equips you to navigate the Linux ecosystem confidently and efficiently.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
      <category>centos</category>
    </item>
    <item>
      <title>SSH Made Easy: Enable Secure Access and File Transfers Like a Pro</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Sat, 28 Dec 2024 14:21:02 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/ssh-made-easy-enable-secure-access-and-file-transfers-like-a-pro-58b1</link>
      <guid>https://dev.to/shweta_thikekar/ssh-made-easy-enable-secure-access-and-file-transfers-like-a-pro-58b1</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is SSH?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SSH (Secure Shell)&lt;/strong&gt; is a protocol that provides secure access to remote systems over an encrypted network. It allows users to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Log in to remote systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Execute commands remotely.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Transfer files securely.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step-by-Step Guide to Enable SSH Between Two Linux Machines&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Two Linux machines with SSH installed (most distributions have SSH pre-installed).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Access to root or a user with sudo privileges on both machines.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Check SSH Installation&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Verify that SSH is installed on both machines:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl status sshd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If not installed, install it using:&lt;/p&gt;

&lt;p&gt;For Ubuntu/Debian&lt;br&gt;
&lt;code&gt;sudo apt install openssh-server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;For RHEL/CentOS&lt;br&gt;
&lt;code&gt;sudo yum install openssh-server&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Start and Enable SSH Service&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Ensure the SSH service is active and enabled to start on boot:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl start sshd&lt;br&gt;
sudo systemctl enable sshd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Configure SSH (Optional)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Modify the SSH configuration file for additional security or customization:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo nano /etc/ssh/sshd_config&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Key settings to check or modify:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Port:&lt;/strong&gt; Default is 22. You can change it to another port for security.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PermitRootLogin:&lt;/strong&gt; Set to no to prevent root login.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PasswordAuthentication:&lt;/strong&gt; Set to no to enforce key-based authentication.&lt;/p&gt;

&lt;p&gt;After making changes, restart the SSH service:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;sudo systemctl restart sshd&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Generate SSH Key Pair&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Generate a public-private key pair on the source machine:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh-keygen -t rsa -b 4096&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The default location is ~/.ssh/id_rsa (private key) and ~/.ssh/id_rsa.pub (public key).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Share the Public Key&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Copy the public key (id_rsa.pub) from the source machine to the remote machine:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh-copy-id user@remote_machine&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Alternatively, manually append the public key to the ~/.ssh/authorized_keys file on the remote machine:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;cat ~/.ssh/id_rsa.pub | ssh user@remote_machine "mkdir -p ~/.ssh &amp;amp;&amp;amp; cat &amp;gt;&amp;gt; ~/.ssh/authorized_keys&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;chmod 600 ~/.ssh/authorized_keys&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Test SSH Connectivity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Attempt to log in without a password:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;ssh user@remote_machine&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;1. SCP (Secure Copy Protocol)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;SCP&lt;/strong&gt; is a simple command-line tool for securely transferring files between Linux systems over SSH. It encrypts data in transit.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;scp [options] source destination&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Copy a file from local to remote server:&lt;br&gt;
&lt;code&gt;scp file.txt user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy a file from remote to local:&lt;br&gt;
&lt;code&gt;scp user@remote:/path/to/file.txt /local/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy a directory recursively:&lt;br&gt;
&lt;code&gt;scp -r /local/directory/ user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-r    Recursively copy directories.&lt;br&gt;
-C  Enable compression for faster transfer of large files.&lt;br&gt;
-v  Verbose mode for debugging.&lt;br&gt;
-p  Preserve the permission and ownership&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;2. PSCP (PuTTY SCP)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;PSCP&lt;/strong&gt; is SCP's counterpart on Windows systems, provided by the PuTTY suite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Setup&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Download PuTTY and ensure pscp.exe is in your PATH.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;pscp [options] source destination&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Copy a file from local to remote server:&lt;br&gt;
&lt;code&gt;pscp file.txt user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy a file from remote to local:&lt;br&gt;
&lt;code&gt;pscp user@remote:/path/to/file.txt C:\local\destination\&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Specify SSH port:&lt;br&gt;
&lt;code&gt;pscp -P 2222 file.txt user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-r    Recursively copy directories.&lt;br&gt;
-q  Quiet mode.&lt;br&gt;
-C  Enable compression.&lt;br&gt;
-v  Verbose/debug mode.&lt;br&gt;
-p  Preserve the permission and ownership&lt;/code&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;3. Rsync&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rsync&lt;/strong&gt; is more advanced than SCP, allowing incremental transfers, bandwidth control, and more.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;rsync [options] source destination&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Examples&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Copy a file from local to remote server:&lt;br&gt;
&lt;code&gt;rsync file.txt user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Copy a directory recursively:&lt;br&gt;
&lt;code&gt;rsync -r /local/directory/ user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Sync files while preserving permissions and timestamps:&lt;br&gt;
&lt;code&gt;rsync -av /local/directory/ user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Use SSH for transfer:&lt;br&gt;
&lt;code&gt;rsync -e ssh file.txt user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Transfer only modified files:&lt;br&gt;
&lt;code&gt;rsync -u /local/directory/ user@remote:/path/to/destination/&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Important Options&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;-r    Recursively copy directories.&lt;br&gt;
-a  Archive mode: preserve permissions, timestamps, etc.&lt;br&gt;
-z  Enable compression for faster transfers.&lt;br&gt;
-e  Specify SSH as the transport protocol.&lt;br&gt;
--progress  Show detailed progress during transfer.&lt;br&gt;
--bwlimit=&amp;lt;kB/s&amp;gt;    Limit bandwidth usage.&lt;br&gt;
-u  Update: skip files that are newer on the destination.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm18ex9u8g6ed8khuunzk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm18ex9u8g6ed8khuunzk.png" alt="Image description" width="573" height="220"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Permissions and Metadata&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;SCP/PSCP: Permissions are preserved unless overridden (e.g., umask on the target).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Rsync: Use -a to preserve all metadata (ownership, permissions, timestamps).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;By enabling SSH between Linux machines and mastering SCP, PSCP, and Rsync commands, you can securely transfer files and manage systems effectively. Understanding these tools not only streamlines administrative tasks but also ensures security in your operations.&lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
    </item>
    <item>
      <title>The Linux Boot Process: A Detailed Walkthrough</title>
      <dc:creator>Shweta Thikekar</dc:creator>
      <pubDate>Mon, 23 Dec 2024 17:40:24 +0000</pubDate>
      <link>https://dev.to/shweta_thikekar/the-linux-boot-process-a-detailed-walkthrough-1j86</link>
      <guid>https://dev.to/shweta_thikekar/the-linux-boot-process-a-detailed-walkthrough-1j86</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fph7j339awxqgfylmm2au.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fph7j339awxqgfylmm2au.png" alt="Image description" width="741" height="510"&gt;&lt;/a&gt;&lt;br&gt;
Understanding how a Linux system boots up is crucial for system administrators, developers, and enthusiasts alike. The Linux boot process is a systematic sequence of steps that prepares the operating system for user interaction. Here's a step-by-step breakdown of the boot process:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Power-On and System Initialization&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When the system is powered on, electricity flows through the motherboard and powers the CPU.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The CPU begins executing the firmware instructions stored in ROM (Read-Only Memory).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This firmware can either be BIOS (Basic Input/Output System) or UEFI (Unified Extensible Firmware Interface), which manages the early hardware initialization.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. POST (Power-On Self Test)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The BIOS/UEFI performs a POST to check essential hardware components such as RAM, CPU, disk drives, and peripherals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If any critical hardware component fails, the system halts and may display error codes or beep sequences.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. Handing Over to the Bootloader&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After POST, BIOS/UEFI locates the bootloader stored on a bootable disk’s Master Boot Record (MBR) or GUID Partition Table (GPT).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The bootloader is a small program responsible for loading the operating system’s kernel.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The most commonly used bootloader in Linux systems is GRUB (GRand Unified Bootloader).&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Bootloader Execution&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;GRUB displays a boot menu if multiple operating systems are installed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The user can select an OS, or GRUB will automatically load the default OS after a timeout.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;GRUB loads the Linux kernel (compressed) into memory and passes control to it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Kernel Initialization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The kernel decompresses itself and initializes the system’s core functionality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It sets up essential hardware interfaces via drivers, including disk drives, memory controllers, and network interfaces.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The kernel performs sanity checks to ensure system integrity.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;6. Starting the Init System&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Once the kernel is ready, it starts the first user-space program, which is typically the init system.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Modern Linux distributions commonly use systemd as the init system, though others like SysVinit or Upstart may be used in specific cases.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;7. Service and Target Initialization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;systemd starts and manages all system services and processes according to its configuration files.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It uses "targets" to define the desired system state, such as:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multi-user mode (non-graphical)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Graphical mode (with GUI)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Single-user mode (for maintenance)&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;8. Reaching the Login Prompt&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;After initializing all essential services, systemd transitions the system to the final target.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;This could be a graphical login screen (using a display manager) or a terminal-based login prompt.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;At this stage, the system is fully booted and ready for user interaction.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Additional Insights:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;BIOS vs. UEFI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;BIOS is the older firmware interface, limited to 16-bit operations and a maximum of 2TB for bootable drives.&lt;/p&gt;

&lt;p&gt;UEFI is the modern replacement, supporting larger drives, faster boot times, and enhanced security features like Secure Boot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GRUB Features&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;GRUB supports:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Chain-loading other bootloaders.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Advanced configurations for multi-boot systems.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Command-line interface for troubleshooting boot issues.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Kernel Responsibilities&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The kernel acts as the bridge between software and hardware.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It includes modules that can be dynamically loaded for additional functionality.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Kernel logs, accessible via &lt;code&gt;dmesg&lt;/code&gt;, provide insights into hardware initialization and potential issues.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Systemd Advantages&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;systemd uses parallelization to speed up the boot process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;It provides powerful tools like &lt;code&gt;systemctl&lt;/code&gt; for managing services.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Journaling features through &lt;code&gt;journalctl&lt;/code&gt; offer robust logging capabilities.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Linux boot process is a fascinating journey from powering on the system to interacting with a fully functional operating environment. Understanding this process not only helps troubleshoot but also deepens your appreciation for the intricacies of modern computing. &lt;/p&gt;

</description>
      <category>linux</category>
      <category>devops</category>
    </item>
  </channel>
</rss>
