Linux Archives - Tricky Enough https://www.trickyenough.com/category/linux/ Explore and Share the Tech Thu, 05 Jun 2025 22:26:11 +0000 en-US hourly 1 https://www.trickyenough.com/wp-content/uploads/2021/05/favicon-32x32-1.png Linux Archives - Tricky Enough https://www.trickyenough.com/category/linux/ 32 32 100835972 How to Remove a User from a Group in Linux? – A Complete Guide https://www.trickyenough.com/how-to-remove-a-user-from-a-group-in-linux-a-complete-guide/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-remove-a-user-from-a-group-in-linux-a-complete-guide https://www.trickyenough.com/how-to-remove-a-user-from-a-group-in-linux-a-complete-guide/#respond Sat, 03 May 2025 21:52:39 +0000 https://www.trickyenough.com/?p=163691 Linux includes a highly adaptable user and group administration system that enables administrators to manage access permissions. In Linux, groups are collections of users with similar access rights, which makes managing multiple users easier. Sometimes, a user needs to be removed from a group. This can happen if a department changes, if there are security...

The post How to Remove a User from a Group in Linux? – A Complete Guide appeared first on Tricky Enough.

]]>
Linux includes a highly adaptable user and group administration system that enables administrators to manage access permissions. In Linux, groups are collections of users with similar access rights, which makes managing multiple users easier.

Sometimes, a user needs to be removed from a group. This can happen if a department changes, if there are security issues, or if a project is finished. Removing a user from a group in Linux is a simple task, but there are several ways to do so, each with its own use case.

This article will show you how to remove a user from a Linux group. It will also cover troubleshooting steps and best practices for managing user access effectively.

Understanding User Groups in Linux

What Are User Groups?

In Linux, user groups are collections of user accounts with the same access permissions. System administrators assign permissions to groups rather than individual users, and all members inherit those privileges.

Types of Groups in Linux

Linux typically utilises two types of groups:

  1. Primary Group:
    • The user’s default group.
    • This group contains all files created by the user unless otherwise specified.
  2. Secondary Groups:
    • Additional groups provide users with greater permissions.
    • A user may belong to many secondary groups.

Why is Group Management Important?

Effective user group management is critical for:

  • Security: Preventing unauthorised access to sensitive data.
  • Efficiency: Simplifying permission management for many users.
  • Organisation: Keeping access levels structured and manageable.

Checking a User’s Group Membership Before Removal

Before removing a user from a group, you need to determine which groups they belong to.

Using the Groups Command

The simplest way to view a user’s group memberships is:

groups username

Example:

groups alice

Output:

alice: alice sudo docker developers

This means Alice is a member of the sudo, docker, and developer groups.

Using the ID Command

To obtain a more detailed result, use:

id username

Example:

uid=1002(alice) gid=1002(alice) groups=1002(alice),27(sudo),999(docker),1003(developers)

Viewing Group Information in /etc/group

You can manually inspect group memberships by checking the /etc/group file:

cat /etc/group | grep username

How to Take a User Out of a Group in Linux

Method 1 – Using gpasswd

The gpasswd command allows you to manage group memberships.

Command Syntax:

sudo gpasswd -d username groupname

Example:

To remove Alice from the Docker group:

sudo gpasswd -d alice docker

Output:

Removing user alice from group docker

Method 2 – Using deluser

The deluser command is another useful tool for removing a user from a group.

Command Syntax:

sudo deluser username groupname

Example:

sudo deluser alice docker

Method 3 – Using usermod

The usermod command changes user properties, including group membership.

Command Syntax:

sudo usermod -G group1,group2 username

Example:

sudo usermod -G sudo alice

Confirming the Removal of the User from the Group

To verify:

groups alice

If the Docker is missing, it means the removal was successful.

Troubleshooting Common Issues

User Still Appears in the Group

  • Log out, then log back in.
  • Restart the system if necessary.

Permission Errors

  • Make sure you run the command with sudo.

Best Practices for Linux Group Management

  • Regularly audit user groups to avoid unauthorised access.
  • To manage users in bulk, use automation tools such as Ansible or shell scripts.
  • Modifying primary groups should be avoided unless it is essential.

Conclusion

Removing a user from a group in Linux is an important activity for system administrators. To keep security and organisation, you must verify changes when using gpasswd, deluser, or usermod. Always follow best practices.

The post How to Remove a User from a Group in Linux? – A Complete Guide appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-remove-a-user-from-a-group-in-linux-a-complete-guide/feed/ 0 163691
How to Install Pip on Linux? – A Complete Step-by-Step Guide https://www.trickyenough.com/how-to-install-pip-on-linux-a-complete-step-by-step-guide/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-install-pip-on-linux-a-complete-step-by-step-guide https://www.trickyenough.com/how-to-install-pip-on-linux-a-complete-step-by-step-guide/#respond Sun, 20 Apr 2025 14:03:00 +0000 https://www.trickyenough.com/?p=163761 Pip (short for “Pip Installs Packages”) is an important tool if you use Python. It allows you to easily install, update, and manage Python packages. Whether creating a development environment or working on a project, having Pip installed makes things much easier. This article will teach you all you need to know about how to...

The post How to Install Pip on Linux? – A Complete Step-by-Step Guide appeared first on Tricky Enough.

]]>
Pip (short for “Pip Installs Packages”) is an important tool if you use Python. It allows you to easily install, update, and manage Python packages. Whether creating a development environment or working on a project, having Pip installed makes things much easier. This article will teach you all you need to know about how to install pip on Linux using various techniques. Whether you use Ubuntu, Debian, Fedora, Centos, or Arch Linux, we have got you covered!

What is Pip? Why Do You Need It?

Pip is a package manager for Python. It allows you to install and manage hundreds of Python libraries listed in the Python Package Index (Pypi). Without Pip, you’d have to manually download and install Python packages, which takes time and is prone to errors.

Why Use Pip?

  • Quick and simple: Install and update Python packages with a single command.
  • Dependency Management: Pip installs dependencies automatically.
  • Access Pypi: Gain access to hundreds of Python libraries.
  • Works with Virtual Environments: Easily manage project-specific dependencies.

Before we begin installation, let us first check to see if Pip is already installed on your system.

Checking If Pip is Already Installed

Before installing Pip, let’s see if it’s already installed.

Step 1: Check for Python Installation

Run this command:

python3 –version

If Python is installed, you’ll see an output like:

Python 3.x.x

If Python is not installed, install it first before proceeding with Pip.

Step 2: Check If Pip is Installed

pip3 –version

If Pip is installed, it will show an output similar to:

pip 22.x.x from /usr/lib/python3/dist-packages/pip (python 3.x)

If you get a “command not found” error, Pip is not installed, and we need to install it.

Installing Pip on Different Linux Distributions

Ubuntu and Debian-based Distributions

Use the following command:

sudo apt update

sudo apt install python3-pip -y

Fedora and Centos

For Fedora:

sudo dnf install python3-pip -y

For Centos 7:

sudo yum install python3-pip -y

Arch Linux

For Arch-based distributions:

sudo pacman -S python-pip

Installing Pip Manually Using get-pip.py

If Pip is not available through your package manager, you can install it manually.

Step 1: Download get-pip.py

curl -O https://bootstrap.pypa.io/get-pip.py

Step 2: Run the Script

python3 get-pip.py

This method ensures you get the latest version of Pip directly from Pypi.

How to Verify Your Pip Installation?

Once installed, verify it using:

pip3 –version

Expected output:

pip 22.x.x from /usr/lib/python3/dist-packages/pip (python 3.x)

Upgrading Pip to the Latest Version

To keep Pip updated:

pip3 install –upgrade pip

Uninstalling Pip

If you need to remove Pip:

  • Ubuntu/Debian sudo apt remove python3-pip 
  • Fedora sudo dnf remove python3-pip 
  • Arch Linux sudo pacman -R python-pip 

Common Pip Installation Errors and Fixes

1. Pip Command Not Found

python3 -m pip –version

If it works, use python3 -m pip install <package>.

2. Permission Errors

Use sudo or install packages for the current user:

pip install –user <package-name>

3. SSL Certificate Issues

Reinstall certificates:

sudo apt install– reinstall ca-certificates

Using Pip to Manage Python Packages

Installing a Package

pip install requests

Uninstalling a Package

pip uninstall requests

Listing Installed Packages

pip list

Working with Virtual Environments

To keep your project dependencies isolated, use a virtual environment.

python3 -m venv myenv

source myenv/bin/activate

Install packages normally inside the environment.

Deactivate with:

deactivate

Automating Installations with requirements.txt

Save installed packages to a file:

pip freeze > requirements.txt

Install all packages from the file:

pip install -r requirements.txt

Best Practices for Using Pip on Linux

  • Use virtual environments for your work.
  • Keep Pip updated regularly.
  • Avoid using sudo pip install, as it may result in system-wide conflicts.

Conclusion

Pip is a necessary tool for Python developers on Linux. How to install pip on Linux is simple, whether using package management or manually with get-pip.py. You can efficiently manage Python packages and simplify your development workflow by sticking to recommended practices.

Suggested:

How to run a Process in the Background on Linux?

Installing Mail Server on Linux: A Step-by-Step Guide.

How to Install Linux on a Flash Drive?

The post How to Install Pip on Linux? – A Complete Step-by-Step Guide appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-install-pip-on-linux-a-complete-step-by-step-guide/feed/ 0 163761
Installing Mail Server on Linux: A Step-by-Step Guide https://www.trickyenough.com/installing-mail-server-on-linux-a-step-by-step-guide/?utm_source=rss&utm_medium=rss&utm_campaign=installing-mail-server-on-linux-a-step-by-step-guide https://www.trickyenough.com/installing-mail-server-on-linux-a-step-by-step-guide/#respond Thu, 17 Apr 2025 23:14:19 +0000 https://www.trickyenough.com/?p=163512 Setting up a mail server on a Linux system may be difficult, but with proper steps, it becomes easy. Whether you want to run your email service for privacy or business purposes, these steps will lead you through installing and operating a mail server on Linux. What is a Mail Server? A mail server is...

The post Installing Mail Server on Linux: A Step-by-Step Guide appeared first on Tricky Enough.

]]>
Setting up a mail server on a Linux system may be difficult, but with proper steps, it becomes easy. Whether you want to run your email service for privacy or business purposes, these steps will lead you through installing and operating a mail server on Linux.

What is a Mail Server?

A mail server is a system for sending, receiving, and storing emails. It consists of several software components, including SMTP (Simple Mail Transfer Protocol) for sending emails and IMAP/POP3 for retrieving them.

Why Install a Mail Server on Linux?

Linux is a popular choice for mail servers due to its security, stability, and open-source nature. Hosting your mail server gives you complete control over your emails, increases privacy, and eliminates the need for third-party providers.

2. Understanding Mail Server Components

SMTP, IMAP, and POP3 Explained

  • SMTP (Simple Mail Transfer Protocol): Manages outgoing emails.
  • IMAP (Internet Message Access Protocol): Users can access emails from multiple devices.
  • POP3 (Post Office Protocol 3): This method downloads emails to a local device and deletes them from the server.

Choosing the Right Software

  • Postfix – The most common SMTP server on Linux.
  • Dovecot – A secure IMAP and POP3 server.
  • MySQL/MariaDB – Helps manage database users.

3. Prerequisites for Installing a Mail Server

Choosing a Linux Distribution

Because of their strong community support and security upgrades, Ubuntu, Debian, and CentOS are popular choices for deploying mail servers.

Setting Up a Domain Name

A domain is needed to send and receive emails. Ensure you have a domain and set up DNS records such as MX, SPF, and DKIM.

4. Installing Required Packages

To install the necessary packages on Debian-based systems, run the following command:

sudo apt update

sudo apt install postfix dovecot-core dovecot-imapd dovecot-pop3d mysql-server spamassassin

For CentOS/RHEL:

sudo yum install postfix dovecot mariadb-server spamassassin

5. Configuring Postfix

Modify Postfix’s main configuration file.

sudo nano /etc/postfix/main.cf

Set the following parameters:

myhostname = mail.example.com

mydomain = example.com

myorigin = $mydomain

inet_interfaces = all

home_mailbox = Maildir/

Restart Postfix.

sudo systemctl restart postfix

6. Configuring Dovecot

Edit the Dovecot configuration file.

sudo nano /etc/dovecot/dovecot.conf

Enable IMAP and POP3:

protocols = imap pop3

Restart Dovecot:

sudo systemctl restart dovecot

7. Setting Up Mysql for Mail Users

Create a database:

CREATE DATABASE mailserver;

USE mailserver;

CREATE TABLE users (email VARCHAR(255) PRIMARY KEY, password VARCHAR(255));

8. Configuring Spam and Security Features

Enable SpamAssassin:

sudo systemctl enable spamassassin

sudo systemctl start spamassassin

Set up SPF and DKIM to avoid email spoofing.

9. Testing the Mail Server

Send a test email:

echo “Test email” | mail -s “Test Subject” user@example.com

Check the mail logs:

sudo tail -f /var/log/mail.log

10. Troubleshooting Common Issues

  • Are emails not sending? Check the firewall and Postfix logs.
  • Authentication failures? Ensure that the Dovecot settings are right.
  • Are emails marked as spam? Configure DKIM and SPF correctly.

Conclusion

Setting up a mail server on Linux requires setting up Postfix, Dovecot, and security software such as SpamAssassin. With the proper configurations, you can have a fully functional email system that is secure and private.

The post Installing Mail Server on Linux: A Step-by-Step Guide appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/installing-mail-server-on-linux-a-step-by-step-guide/feed/ 0 163512
How to Install Guest Additions in VirtualBox on Ubuntu? https://www.trickyenough.com/how-to-install-guest-additions-in-virtualbox-on-ubuntu/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-install-guest-additions-in-virtualbox-on-ubuntu https://www.trickyenough.com/how-to-install-guest-additions-in-virtualbox-on-ubuntu/#respond Mon, 17 Mar 2025 12:31:00 +0000 https://www.trickyenough.com/?p=163612 You may have noticed certain limitations if you installed Ubuntu as a guest operating system in VirtualBox. The screen resolution may be stuck, file sharing between the host and guest may fail, and overall performance may appear sluggish. This is where the VirtualBox Guest Additions come in. In this post, we will show you how...

The post How to Install Guest Additions in VirtualBox on Ubuntu? appeared first on Tricky Enough.

]]>
You may have noticed certain limitations if you installed Ubuntu as a guest operating system in VirtualBox. The screen resolution may be stuck, file sharing between the host and guest may fail, and overall performance may appear sluggish. This is where the VirtualBox Guest Additions come in. In this post, we will show you how to install VirtualBox Guest Additions in Ubuntu.

Guest Additions are a collection of drivers and utilities that enhance the integration of the host and guest operating systems. Installing Guest Additions unlocks various valuable functions, such as:

  • Mouse Integration is seamless, with no need to press a key to release the mouse.
  • Shared Clipboard allows for copying and pasting between the host and guest operating systems.
  • Drag and Drop Support easily transfers files between systems.
  • Improved video performance by dynamically resizing the guest OS screen.
  • Shared Folders allow you to access host files from the guest system.

Prerequisites

Before starting with the installation, ensure that you meet the following requirements:

1. System Requirements

  • A working VirtualBox installation.
  • VirtualBox-based Ubuntu guest OS with enough free storage (at least 500MB)

2. Ensure VirtualBox is Installed

If you haven’t already downloaded and installed VirtualBox, do so from the official website.

3. Install Necessary Packages

You must first install some essential packages before proceeding to install Guest Additions. Run the following command on the Ubuntu terminal:

sudo apt update && sudo apt upgrade -y

sudo apt install build-essential dkms linux-headers-$(uname -r)

These packages guarantee that the Guest Additions modules are compiled properly.

Step-by-Step Guide to Install Guest Additions in Ubuntu

Step 1: Update Ubuntu System

Keeping your system up to date is usually a smart idea when installing new applications. Open the terminal and run:

sudo apt update && sudo apt upgrade -y

Step 2: Install Required Dependencies

To ensure a smooth installation, install the following packages:

sudo apt install build-essential dkms linux-headers-$(uname -r)

Step 3: Insert the Guest Additions ISO Image

  1. Launch VirtualBox and activate your Ubuntu virtual computer.
  2. In VirtualBox, select Devices > Insert Guest Additions CD Image.
  3. To begin the installation, click Run when prompted.

Step 4: Mount the ISO Image Manually (If Not Auto-Mounted)

If the ISO does not mount itself, open a terminal and run:

sudo mount /dev/cdrom /mnt

Step 5: Run the Guest Additions Installer

Once the ISO has been mounted, proceed to the directory and run the installer:

cd /mnt

sudo ./VBoxLinuxAdditions.run

Wait for the installation to be completed.

Step 6: Restart Ubuntu to Apply Changes

After the installation, restart the Ubuntu guest system:

sudo reboot

Verifying the Installation

After the system restarts, see if the installation was successful.

  1. Seamless Mouse Integration – Move the mouse freely between the host and the visitor without pressing the release key.
  2. Screen Resizing – Try resizing the VirtualBox window and see whether Ubuntu adjusts accordingly.
  3. Shared Clipboard and Drag-and-Drop – Turn them on in VirtualBox’s Devices > Shared Clipboard and Drag-and-Drop settings.

If these features work, the installation is complete!

Troubleshooting Common Issues

1. Guest Additions ISO Not Found

If VirtualBox cannot find the ISO, manually download it from the VirtualBox website.

2. Unable to Mount Guest Additions to ISO

Try manually mounting it with the following:

sudo mount /dev/cdrom /mnt

3. Kernel Headers Not Found Error

Ensure that you have installed them correctly using:

sudo apt install linux-headers-$(uname -r)

4. Screen Resolution Not Changing

If the resolution does not change, try running:

xrandr –auto

5. Shared Clipboard or Drag-and-Drop Not Working

Check that they are enabled in VirtualBox settings under Devices > Shared Clipboard and Devices > Drag and Drop.

Conclusion

How to install VirtualBox Guest Additions on Ubuntu is a simple operation that can greatly improve your virtual machine experience. It improves performance, allows for flawless integration with the host system, and unlocks helpful capabilities like a shared clipboard, drag-and-drop, and seamless display scaling.

Following the instructions in this article should result in a fully running Ubuntu VM with all Guest Addition capabilities enabled. If you find any problems, check the troubleshooting section for solutions to common issues.

The post How to Install Guest Additions in VirtualBox on Ubuntu? appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-install-guest-additions-in-virtualbox-on-ubuntu/feed/ 0 163612
How to Install Linux on a Flash Drive? https://www.trickyenough.com/how-to-install-linux-on-a-flash-drive/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-install-linux-on-a-flash-drive https://www.trickyenough.com/how-to-install-linux-on-a-flash-drive/#respond Fri, 14 Mar 2025 12:20:43 +0000 https://www.trickyenough.com/?p=163443 Linux is a powerful, safe, and adaptable operating system widely used by developers, IT experts, and common users seeking greater control over their systems. However, before you can enjoy its benefits, you must install it on your computer. Fortunately, installing Linux is easier than ever. Modern Linux distributions have straightforward, user-friendly installers that walk you...

The post How to Install Linux on a Flash Drive? appeared first on Tricky Enough.

]]>
Linux is a powerful, safe, and adaptable operating system widely used by developers, IT experts, and common users seeking greater control over their systems. However, before you can enjoy its benefits, you must install it on your computer.

Fortunately, installing Linux is easier than ever. Modern Linux distributions have straightforward, user-friendly installers that walk you through the process step by step. However, before you begin the installation process, you must first create a bootable USB device.

A bootable USB stick enables you to install Linux on your computer or operate it as a live environment without causing any permanent changes to your system. What is the best part? Creating one is easy, and you do not need to be a tech expert to do it.

This guide will walk you through the entire procedure of how to install Linux on a flash drive, allowing you to effortlessly generate a bootable USB and install Linux on your PC.

What do you need to create a Bootable Linux USB?

Before we begin the process, make sure you have the following:

A computer with a USB port – This is the system where you will make the bootable drive.

A USB flash drive (at least 16GB) – A larger USB drive (32GB or more) is much preferable, especially if you want to use it as a portable Linux system.

A Linux ISO file – This is the installation file for the Linux distribution that you want to install. Popular choices include:

A tool to create the bootable USB – There are multiple tools available for this, but some of the most reliable ones are:

For this article, we’ll use UNetbootin, which is compatible with Linux, Windows, and MacOS.

Step 1: Download and Install UNetbootin

If you are using Windows or macOS, follow these steps:

  1. Visit the official UNetbootin website.
  2. Download the most recent version for your operating system.
  3. Run the downloaded file to install the software.

If you’re using Linux (Ubuntu-based systems), open a terminal and type these commands:

sudo add-apt-repository ppa:gezakovacs/ppa

sudo apt-get update

sudo apt-get install unetbootin -y

This will install UNetbootin on your PC, allowing you to generate a bootable USB.

Step 2: Insert Your USB Drive

Now that UNetbootin is installed, plug your USB flash drive into your computer.

Important Notes:

Backup your data: Everything on the USB drive will be wiped during this operation.

Check the USB drive name. On Linux, use the command lsblk to list all connected devices.

Step 3: Open UNetbootin and Select Your Linux Distribution

  1. Launch UNetbootin from the Applications menu.
  2. In the main window, select one of the following.
    • Choose a distribution from the list if you want UNetbootin to download the ISO.
    • If you have downloaded the Linux installation file, use an existing ISO.
  3. If you selected a distribution, select the most recent version from the “Version” selection.

Step 4: Choose the USB Drive

  1. Select USB Drive from the “Type” menu.
  2. Select the correct USB disc from the “Drive” selection menu.

How to Make Sure You Select the Correct Drive:

  • If you are using Windows, go to Disc Management and check the USB drive letter.
  • If you’re running Linux, type lsblk in the terminal to get a list of drives.

Tip: To avoid picking the incorrect drive, remove all other external storage devices before proceeding.

Step 5: Create the Bootable USB Drive

  1. Click OK to begin the process.
  2. Unetbootin will:
    • Download the required files (if needed).
    • Extract and copy to the USB.
    • Install a bootloader so that your USB can boot properly.
    • Finalize the process.

Time required: It usually takes 5 to 15 minutes, depending on your system and USB speed.

If UNetbootin looks to get stuck at “Extracting and Copying Files,” do not panic; it will ultimately finish.

Step 6: Safely Remove Your USB Drive

Once the process is complete:

  • Click Exit in UNetbootin.
  • Take your USB drive out of your computer safely.
  • Your bootable Linux USB is now ready! 

Step 7: Boot from the USB Drive and Install Linux

Now that your bootable USB is ready, you can learn how to install Linux on a flash drive and enjoy your new system!

  1. Insert the USB drive into the computer where you intend to install Linux.
  2. Restart the computer and navigate to the BIOS or boot menu (typically by pressing F2, F12, DEL, or ESC at startup).
  3. Select your USB drive to be the boot device.
  4. The Linux installer will run; simply follow the on-screen directions to complete the installation.

That’s it! You now have Linux running on your machine.

Conclusion

Tools such as UNetbootin, Rufus, and Etcher make it easier than ever to create a bootable Linux USB drive. Whether you want to install Linux as your primary operating system or learn how to install Linux on a flash drive for live testing, this method provides a simple and fast solution.

Suggested:

How Can You Use USB Flash Drives in a Non-Standard Way?

The post How to Install Linux on a Flash Drive? appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-install-linux-on-a-flash-drive/feed/ 0 163443
CentOS 7 Single User Mode: A Detailed Step-by-Step Guide https://www.trickyenough.com/centos-7-single-user-mode/?utm_source=rss&utm_medium=rss&utm_campaign=centos-7-single-user-mode https://www.trickyenough.com/centos-7-single-user-mode/#respond Wed, 12 Mar 2025 00:07:00 +0000 https://www.trickyenough.com/?p=163686 CentOS 7 is one of the most popular Linux distributions in server environments due to its reliability, security, and long-term support. However, even the most powerful systems might experience problems that prevent them from booting or running properly. This is when the Single User Mode comes into play. It is a lightweight, special-purpose mode that...

The post CentOS 7 Single User Mode: A Detailed Step-by-Step Guide appeared first on Tricky Enough.

]]>
CentOS 7 is one of the most popular Linux distributions in server environments due to its reliability, security, and long-term support. However, even the most powerful systems might experience problems that prevent them from booting or running properly.

This is when the Single User Mode comes into play. It is a lightweight, special-purpose mode that enables system administrators to debug, repair, and adjust system settings without interfering with other users or services. Single User Mode gives the tools you need to complete a task, such as resetting a forgotten root password, repairing file system issues, or editing key system files.

In this guide, we’ll go over how to access, operate, troubleshoot, and secure Single User Mode in CentOS 7 to keep your system running smoothly and securely.

Understanding Single User Mode in CentOS 7

What is Single User Mode?

Single User option, often known as runlevel 1, is a basic boot option that loads only the most needed services. The system is not networked, and only the root user can access it. This mode is primarily intended for troubleshooting and maintenance work.

When and Why Should You Use Single User Mode?

System administrators use Single User Mode for several key operations, including:

  • Recovering from boot problems: If your system fails to boot because of corrupted files or incorrectly configured settings, Single User Mode allows you to manually resolve these issues.
  • Resetting a forgotten root password: If you are unable to access your system, utilize Single User Mode to reset the root password.
  • Repairing file system issues: The mode allows you to check and repair disc faults with fsck.
  • Fixing misconfigured system settings: If a recent change has caused your system to behave randomly, you can restore stability by editing configuration files.

Differences Between Single User Mode and Rescue Mode

FeatureSingle User ModeRescue Mode
NetworkingNoYes
Multi-User AccessNoNo
Used for Password ResetYesYes
Used for File System RepairsYesYes
More Interactive Recovery ToolsNoYes

While Rescue Mode provides additional tools and services, Single User Mode is best for performing short maintenance activities without the need for networking.

How to Access Single User Mode in CentOS 7?

1: Reboot and Access the GRUB Menu

  1. Restart the CentOS 7 system.
  2. To reach the GRUB bootloader menu, repeatedly press the Esc or Shift key while the system is booting.

Step 2: Edit the GRUB Boot Parameters

  1. In the GRUB menu, choose the CentOS 7 system item you want to change.
  2. Press e to enter edit mode.
  3. Find the line that begins with linux16 or linuxefi.
  4. Add rd.break to the end of the line.

Step 3: Entering Emergency Mode for Maintenance

  1. To boot with the updated parameters, press Ctrl + X.
  2. You’ll now be in Emergency Mode with a minimum shell.
  3. To provide complete system access, run:

mount -o remount,rw /sysroot

chroot /sysroot

Common Tasks in Single-User Mode

Resetting the Root Password

  1. Run: passwd root
  2. Create a new password and confirm it.
  3. Relabel SELinux so that modifications can take effect:

touch /.autorelabel

Exit

reboot

Checking and Repairing File System Errors

Use the following command:

fsck -y /dev/sda1

Editing Configuration Files for System Recovery

Use nano or vi to edit key files like /etc/fstab or /etc/passwd.

Securing Single User Mode to Prevent Unauthorized Access

Setting a GRUB Password

To prevent unauthorized changes, create a GRUB password:

grub2-setpassword

Using Disk Encryption

Encrypt sensitive partitions to prevent unauthorized data access.

Conclusion

Single User Mode is a vital tool for system administrators for troubleshooting and repairing CentOS 7 installations. Whether you need to reset passwords, repair file systems, or fix misconfigurations, this mode offers the required capabilities in a secure, controlled environment.

The post CentOS 7 Single User Mode: A Detailed Step-by-Step Guide appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/centos-7-single-user-mode/feed/ 0 163686
How to run a Process in the Background Linux? https://www.trickyenough.com/how-to-run-a-process-in-the-background-linux/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-run-a-process-in-the-background-linux https://www.trickyenough.com/how-to-run-a-process-in-the-background-linux/#respond Mon, 24 Feb 2025 12:25:54 +0000 https://www.trickyenough.com/?p=163628 Linux is an advanced operating system that enables users to run numerous tasks simultaneously. One of its most valuable features is the ability to execute programs in the background, which frees up the terminal for other purposes. This capability is critical for system administrators, developers, and anyone who wants to manage time-consuming operations without occupying...

The post How to run a Process in the Background Linux? appeared first on Tricky Enough.

]]>
Linux is an advanced operating system that enables users to run numerous tasks simultaneously. One of its most valuable features is the ability to execute programs in the background, which frees up the terminal for other purposes. This capability is critical for system administrators, developers, and anyone who wants to manage time-consuming operations without occupying the terminal. This article will look at how to run a process in the background on Linux. We’ll review many methods, instructions, and best practices for properly managing background processes.

What Are Foreground and Background Processes?

Before we go into the methods, it’s essential to understand the difference between foreground and background processes in Linux.

A foreground process is running on the terminal, needing user input and stopping the shell until it completes. When you run a command at the terminal, it usually runs in the foreground by default.

A background process, on the other hand, operates independently of the terminal, allowing you to continue using the command line while the process is executed in the background. This is important for time-consuming processes like downloading huge data, running scripts, and assembling programs.

How to Use Linux for Background Process Execution

1. Using the Ampersand (&) Operator

The simplest way how to run a process in the background Linux is to include an ampersand (&) at the end of the command.

Example:

ping google.com > output.txt &

This command will start the ping process in the background and redirect the results to a file called output.txt.

After performing the command, the system will return a process ID (PID), which indicates that the process is operating in the background.

2. Using the nohup Command

The nohup (no hang-up) command allows a process to operate even after the terminal is closed. This is useful when you want to start a background process and then log out of the session without terminating it.

Example:

nohup python script.py &

Nohup automatically saves its output to a file named nohup.out. To choose a different output file, perform the following:

nohup python script.py > output.log 2>&1 &

This guarantees that both standard output and errors are written to output.log.

3. Using the disown Command

If you’ve previously launched a background process with & and want it to keep running even after you log out, use the disown command.

Example:

./long_script.sh &

disown

This removes the job from the shell’s job table, preventing it from being terminated after the session is over.

4. Using screen or tmux

The screen and tmux tools offer comprehensive session management capabilities, allowing you to run programs in the background and reconnect to them later.

Using screen Example:

screen -S mysession

Run your command within the screen session.

python script.py

Detach from the session with:

Ctrl + A, then D

You may later reattach using:

screen -r mysession

Using tmux Example:

tmux new -s mysession

Run your process and then detach with:

Ctrl + B, then D

To reattach:

tmux attach -t mysession

Managing Background Processes

Checking Running Background Jobs

To display all background jobs in your session, use:

jobs -l

This will provide a list of active and halted background jobs, along with their work IDs.

Bringing a Background Process to the Foreground

To bring a background process back to the foreground, use the following:

fg %1

Replace 1 with the job ID that appears in the jobs command.

Killing a Background Process

To stop a background process, use:

kill PID

Replace the PID with the process ID. If the process doesn’t end, use:

kill -9 PID

Conclusion

Running programs in the background in Linux is a useful technique for increasing multitasking and productivity. Whether you use the & operator, nohup, disown, or session managers like screen and tmux, every method has advantages based on your requirements. Understanding how to control background activities correctly can allow you to work more efficiently and minimize unnecessary disruptions.

The post How to run a Process in the Background Linux? appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-run-a-process-in-the-background-linux/feed/ 0 163628
How to Copy and Paste in Nano?: The Guide for Beginners https://www.trickyenough.com/how-to-copy-and-paste-in-nano-the-guide-for-beginners/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-copy-and-paste-in-nano-the-guide-for-beginners https://www.trickyenough.com/how-to-copy-and-paste-in-nano-the-guide-for-beginners/#respond Mon, 24 Feb 2025 12:24:13 +0000 https://www.trickyenough.com/?p=163671 Nano is among the most popular text editors for Linux and Unix-based operating systems. Unlike graphical editors like Notepad or Microsoft Word, Nano functions exclusively on the command line, which makes text manipulation slightly different from what most people are used to. If you’re new to Nano, one of the first things you should learn...

The post How to Copy and Paste in Nano?: The Guide for Beginners appeared first on Tricky Enough.

]]>
Nano is among the most popular text editors for Linux and Unix-based operating systems. Unlike graphical editors like Notepad or Microsoft Word, Nano functions exclusively on the command line, which makes text manipulation slightly different from what most people are used to. If you’re new to Nano, one of the first things you should learn is how to copy and paste text in the editor. Because Nano does not use typical copy-paste shortcuts such as Ctrl + C and Ctrl + V, understanding its unique approach is critical for efficient text editing. This article will teach you how to copy and paste in Nano, including step-by-step instructions, troubleshooting hints, and alternate approaches to help your workflow run smoothly.

What is Nano?

Nano is a basic command-line text editor running on LinuxmacOS, and Unix-based computers. It is frequently pre-installed in many distributions, making it a useful tool for quick text editing. Unlike more complicated editors such as Vim or Emacs, Nano is supposed to be simple, with straightforward keyboard shortcuts for performing various actions.

Image Credits: Screenshot taken from Nano

Why is Nano Different from Other Text Editors?

To copy and paste in graphical text editors, press Ctrl + C or Ctrl + V. However, Nano does not support these typical shortcuts because it only works in the terminal, where Ctrl + C is used to interrupt processes rather than copying text.

Instead, Nano has its own set of keyboard keys for copying (cutting) and pasting text, which we will go over in detail.

Why Learn to Copy and Paste Commands in Nano?

Knowing how to copy and paste in Nano can help you save time and effort while editing configuration files, writing scripts, or making rapid text changes on a server. Once you’ve mastered these instructions, you’ll be able to modify files much more quickly without going to a different text editor.

Getting Started with Nano

Checking if Nano is Installed

Most Linux distributions include Nano pre-installed. To determine whether you have Nano, open the terminal and type:

nano –version

If Nano is installed, it will show the version number.

Installing Nano

If Nano is not installed, you can install it using the following commands, depending on the operating system:

  • Debian-based systems (Ubuntu, Debian, Linux Mint):
    sudo apt install nano
  • RHEL-based systems (CentOS, Fedora, Rocky Linux):
    sudo yum install nano
  • macOS (using Homebrew):
    brew install nano

Opening a File in Nano

You can use the following to open an existing file in Nano:

nano filename.txt

If the file does not already exist, Nano will generate a new one when you save it.

Understanding Nano Keyboard Shortcuts

Why Traditional Copy-Paste Shortcuts Don’t Work in Nano?

As already mentioned, Nano does not support Ctrl + C and Ctrl + V for copying and pasting because Ctrl + C is used to stop processes in the terminal. Instead, Nano uses several shortcuts for these functions.

Essential Key Combinations for Text Manipulation

Here are some of the most essential Nano shortcuts:

FunctionShortcut
Copy (Cut) TextCtrl + K
Paste TextCtrl + U
Select TextCtrl + 6
Save FileCtrl + O
Exit NanoCtrl + X

How to Copy (Cut) Text in Nano?

Step 1: Marking the Text

  1. Move your mouse to the beginning of the text you wish to copy.
  2. Press Ctrl + 6 to begin choosing text.

Step 2: Cutting the Text (Copying in Nano)

  1. Once you’ve marked the text, use Ctrl + K to cut it.
  2. The text is now saved in Nano’s clipboard (cut buffer).

How to Paste Text in Nano?

Step 3: Pasting the Copied Text

  1. To paste the text, move your mouse to the desired location.
  2. Press Ctrl + U to paste the copied content.

Copying and Pasting from External Sources

To copy and paste text from an external source, such as a web browser or another file, use your terminal emulator’s mouse selection mechanism.

  • Linux:
    • Select text with your mouse.
    • Ctrl + Shift + C will copy.
    • Use the shortcut to paste, Ctrl + Shift + V.
  • macOS:
    • Select the text.
    • To copy, use Cmd + C.
    • To paste, use Cmd + V.

Troubleshooting Common Issues

Copy-Paste Not Working in Nano?

  • Make sure your terminal supports text selection.
  • If you’re using SSH, be sure that clipboard sharing is enabled.

Fixing Terminal Settings to Enable Mouse Support

Some terminal emulators turn off mouse support in Nano. Use the following command to make it active:

nano –mouse

Conclusion

Now that you know how to copy and paste in Nano, your workflow will be a lot more efficient. The essential shortcuts to memorize include: Ctrl + 6 → To start choosing text, use Ctrl + K. To cut or copy the highlighted text, use Ctrl + U. Paste the copied text. By learning these commands, you’ll be an expert at using Nano in no time!

Suggested:

How do you run a Background Process in Linux?

Linux or Windows? What OS to choose for your server?

The post How to Copy and Paste in Nano?: The Guide for Beginners appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-copy-and-paste-in-nano-the-guide-for-beginners/feed/ 0 163671
How to Disable Root Login in Ubuntu for Enhanced Server Security? https://www.trickyenough.com/how-to-disable-root-login-in-ubuntu-for-enhanced-server-security/?utm_source=rss&utm_medium=rss&utm_campaign=how-to-disable-root-login-in-ubuntu-for-enhanced-server-security https://www.trickyenough.com/how-to-disable-root-login-in-ubuntu-for-enhanced-server-security/#respond Mon, 24 Feb 2025 11:58:25 +0000 https://www.trickyenough.com/?p=163479 Securing your Linux-based server is a key step toward preventing unauthorized access and security threats. One of the most efficient ways to do this is to disable root login in Ubuntu via SSH. By default, all Linux systems include a root user who has complete control over the system. This means that if an attacker...

The post How to Disable Root Login in Ubuntu for Enhanced Server Security? appeared first on Tricky Enough.

]]>
Securing your Linux-based server is a key step toward preventing unauthorized access and security threats. One of the most efficient ways to do this is to disable root login in Ubuntu via SSH.

By default, all Linux systems include a root user who has complete control over the system. This means that if an attacker acquires root access, they will be able to completely control, alter, or destroy your server. Allowing root login over SSH raises the risk of brute-force attacks, in which hackers attempt to guess your root password and get access.

To improve security, disable root login and establish a non-root user with administrative access. In this post, we’ll walk you through the steps to deactivate root login via SSH on Ubuntu, preventing unauthorized users from accessing your server as root.

Step 1: Logging In and Checking Authentication Logs

Before making any changes to the SSH setup, you must connect to your server as a non-root user with sudo capabilities. You will also check the authentication logs for any unauthorized login attempts.

Accessing Your Server as a Non-Root User

To log in with a password, run the following line in your terminal:

ssh sammy@your_server_ip

To perform key-based authentication, use:

ssh -i your_private_key sammy@your_server_ip

Note: Replace sammy with the username of your sudo-enabled user and your_server_ip with the IP address of the Ubuntu server.

You should create a sudo-enabled account before removing the root login. Without a sudo user, you may lose administrative control over your server.

Checking Authentication Logs for Unauthorized Access

Once logged in, go to the authentication logs directory.

cd /var/log/

To view the authentication log, run the following command:

sudo cat auth.log

This log includes all login attempts to your server, both successful and failed. If you notice several failed login attempts, it indicates that someone is attempting to break into your server.

Disabling root login significantly lowers the risk of brute-force attacks and unauthorized access.

Step 2: Disable Root Login Ubuntu Over SSH

To disable root login, edit the SSH configuration file and restart the SSH service.

Editing the SSH Configuration File

Open the SSH daemon configuration file with a text editor, such as nano.

sudo nano /etc/ssh/sshd_config

Search for the following line in the file:

PermitRootLogin yes

Change it to:

PermitRootLogin no

This setting informs the SSH daemon to refuse all SSH login attempts from the root user.

Tip: If the line does not already exist in your configuration file, add it at the end.

After making the changes, save the file by pressing CTRL + X, Y, and Enter.

Restarting the SSH Service

To apply the modifications, restart the SSH service by running the following command:

sudo systemctl restart sshd

Restarting the SSH service ensures that any configuration changes take effect immediately.

Step 3: Testing If Root Login Is Disabled

Now that we’ve changed the SSH setup, we’ll see if the root login is disabled.

Attempting to Log In as Root

Open a new terminal window and attempt to log in as the root user.

In the case of password-based authentication:

ssh root@your_server_ip

For authentication based on keys:

ssh -i your_private_key root@your_server_ip

If the changes were successfully implemented, you should get the following error message:

Permission denied; please try again.

This confirms that SSH no longer supports root logins.

Logging In with a Sudo User

Because root login is disabled, you should now visit the server as a non-root user.

In the case of password-based authentication:

ssh sammy@your_server_ip

For authentication based on keys:

ssh -i your_private_key sammy@your_server_ip

Once logged in, you can use sudo to conduct administrative activities. For example, to upgrade your system, run:

sudo apt update && sudo apt upgrade -y

Using a sudo-enabled user allows you to maintain complete control over your system while keeping it secure.

Additional Security Tips

In addition to blocking root login, you should adopt the following security measures:

  1. Use SSH Key Authentication: To improve security, use SSH keys rather than passwords.
  2. Change the SSH Port: Change the SSH port (22) by default to reduce your risk of brute-force attacks.

Enable a Firewall: Use the Uncomplicated Firewall (UFW) to prevent unwanted access:
sudo ufw allow OpenSSH

sudo ufw enable

  1. Use Fail2Ban: To automatically block IP addresses with a history of unsuccessful login attempts, install Fail2Ban.

Regularly Update Your System: Update your server regularly to fix security flaws.
sudo apt update && sudo apt upgrade -y

Conclusion

We discussed how to disable root login ubuntu in this article. Ubuntu to make your Linux-based computer more secure. We effectively prevented direct root access by changing the SSH configuration file and restarting the SSH service, which lowered the possibility of unwanted access.

Your server is now more secure with root login disabled, and you may still use a sudo-enabled non-root user to carry out administrative activities.

You can further strengthen your server’s defenses by following best security practices, which include using SSH keys, changing the default SSH port, and turning on a firewall.

The post How to Disable Root Login in Ubuntu for Enhanced Server Security? appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/how-to-disable-root-login-in-ubuntu-for-enhanced-server-security/feed/ 0 163479
Linux or Windows? What OS to choose for your server? https://www.trickyenough.com/linux-or-windows-what-os-to-choose-for-your-server/?utm_source=rss&utm_medium=rss&utm_campaign=linux-or-windows-what-os-to-choose-for-your-server https://www.trickyenough.com/linux-or-windows-what-os-to-choose-for-your-server/#respond Sun, 03 Mar 2024 20:20:20 +0000 https://www.trickyenough.com/?p=114639 Before purchasing and setting up a server, you need to consider which operating system you want to use with your server. An average user probably won’t feel the difference between Linux or Windows server OS; however, businesses might have specific technical requirements that could be affected by the choice of an operating system. The choice...

The post Linux or Windows? What OS to choose for your server? appeared first on Tricky Enough.

]]>
Before purchasing and setting up a server, you need to consider which operating system you want to use with your server.

An average user probably won’t feel the difference between Linux or Windows server OS; however, businesses might have specific technical requirements that could be affected by the choice of an operating system.

The choice between Linux and Windows operating systems depends on many factors, however, location isn’t one of them: you can have a VPS server in Hong Kong or Canada, and the question of which OS is the best for you remains.

We gathered some helpful tips on determining which operating system will work for you.

Differences between Linux and Windows OS for a server

Linux is an open-source operating system commonly used in server setups. It offers a range of distributions that are designed to cover the different needs of users and organizations. Linux is considered a more flexible and customizable option than Windows since one gets more control in terms of OS configuration.

Overall, as an operating system for servers, Linux can enrich a server with unique characteristics.

  • Linux OS provides more options for multitasking, including support for several users and tasks.
  • The Linux server is shielded with three security layers: authorization, authentication, and encryption.
  • Linux is an open-source operating system, which means you can get it for free.
  • There is a multitude of various tools for the Linux operating system that you can use for managing your server.
  • The community of Linux OS users can provide you with guidance and support on how to use it with a specific server type.

Windows OS for a server is a paid solution by Microsoft. The server version of Windows has an easy-to-use interface, which is especially convenient for users who are new to server management. Besides, Microsoft offers a 5-year support and maintenance guarantee.

Here are some feature-related aspects to consider when choosing Windows as your server OS:

  • Windows OS already comes with graphic user interfaces (GUI).
  • Servers operating on Windows are easier to set up and configure.
  • Windows operating system comes with technical support active for the duration of the license.
  • Some versions of Windows offer a built-in firewall, encryption functionality, and virtualization software.
  • Windows OS is often associated with a more stable performance.

In short, Linux provides more control and flexibility, while Windows OS is considered more beginner-friendly and has more support from a technical standpoint.

Tips on how to pick between Linux and Windows for your server

The difference between the two operating systems might still seem somewhat vague. However, both Linux OS and Windows OS have their use cases.

Here are some tips on how to find yours.

1. Start with the hosting option you want to use

The truth is that not all hosting providers offer the choice between operating systems.

Commonly, shared hosting comes with Linux OS. With VPS Server and dedicated servers, you can find Windows options as well. It’s important to pay attention to whether the specific server type and hosting plan offer a pre-defined option of the operating system or allow the user to choose which OS they want to work with.

Keep in mind that the choice between Linux OS and Windows OS for your server is not influenced by the operating system of your computer. If you have your PC running on Windows, you can use the Linux-based server with no complications; the same goes for MacOS.

However, the choice of an operating system plays a role in your website’s functioning. This aspect is based on applications your server OS allows you to install and use for managing your website.

2. Consider what applications you want to use for server management

Before deciding on the operating system, think about what tools you want to use with your server OS. For example:

  • Microsoft Access or Microsoft SQL will work with the Windows-based server only, but that’s kind of a given.
  • WordPress is easier to use on Linux-based servers; WordPress can be used on Windows, but the setup process will be more complicated.
  • Certain control panels like cPanel are built on Linux, so it would be easier to use on the Linux-based server.
  • Python and Perl programming languages would be comfortably used on Linux.
  • You can use C# language on a Windows server.

So, if your website requires certain applications, consider them first before deciding on the operating system.

3. Identify the security level you need

When it comes to security, the first factor to look at would be performance. Linux usually handles processes with fewer issues and requires less rebooting. This is attributed to the fact that Windows OS is associated with memory leaks that don’t happen as often on Linux.

However, bugs and vulnerabilities are easier to find and resolve with Windows OS because Microsoft offers extensive documentation and professional technical support; with Linux, it might be more complicated.

If you install Windows OS on your server, you can use the graphical user interface straight out of the box; with Linux, you have to set up GUI separately. Similarly, Microsoft releases new drivers quite fast and often, while drivers for Linux take some time to be released (also depending on the distribution you’re using).

To sum up,

Like with many things, the choice of the OS for your server depends on your needs and budget.

Both Linux OS and Windows OS are great options; however, Linux is free, and Windows isn’t. If you don’t have extra money to purchase Windows, you can easily manage your server with Linux OS. If you are tech-savvy and can manage to be in control of multiple processes within your operating system, Linux will probably be a natural choice for you.

In any case, whichever operating system you choose will be the best option for you.

Suggested:

Best Linux Distribution for kids.

List of Best Antivirus For Linux Mint.

List of Best Linux Calendar Apps.

The post Linux or Windows? What OS to choose for your server? appeared first on Tricky Enough.

]]>
https://www.trickyenough.com/linux-or-windows-what-os-to-choose-for-your-server/feed/ 0 114639