Linux User Modifying

LinuxLinuxBeginner
Practice Now

Introduction

In the fiery depths of Demon Hell, a dark and foreboding place where only the bravest dare to tread, there lies a challenge waiting for the bold. Here, the Dark Lord of Hell reigns supreme, commanding his legions with iron-fisted control. However, even the Dark Lord needs order within his chaotic realm. To maintain the hierarchy of his demon army, his subjects’ identities must be meticulously managed and modified to reflect their rank and role.

Your mission, should you choose to accept it, is to master the art of modifying user information on Linux — a skill that could tip the scales of power in Demon Hell. Prove yourself by wielding the usermod command effectively, showcasing your ability to manipulate user attributes with ease. Excel in this task, and you may earn the favor of the Dark Lord himself!


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/UserandGroupManagementGroup(["`User and Group Management`"]) linux/UserandGroupManagementGroup -.-> linux/usermod("`User Modifying`") subgraph Lab Skills linux/usermod -.-> lab-271427{{"`Linux User Modifying`"}} end

Setting up the Demon Realm

In this step, you will create a new user who represents a lesser demon in the hierarchy of Hell. This demon, currently known as 'lesserdemon', must be renamed and elevated in rank to mimic the ever-shifting power dynamics of the underworld.

In your terminal, located at ~/project, start by creating a new user:

sudo useradd lesserdemon

Now, let's rename 'lesserdemon' to 'greaterdemon' and move it to a new home directory to signify its promotion:

sudo usermod -l greaterdemon lesserdemon
sudo usermod -d /home/greaterdemon -m greaterdemon

These two commands revise the username and move the user home directory, reflecting the demon's new status.

Bestowing Special Permissions

Now that 'greaterdemon' has been promoted, it is time to grant it appropriate powers. In this step, you'll add the demon to the 'wheel' group to give it sudo privileges, reflecting its elevated rank.

First, verify that the 'wheel' group exists, and create it if necessary:

if ! grep -q '^wheel:' /etc/group; then
  sudo groupadd wheel
fi

Next, add 'greaterdemon' to the 'wheel' group:

sudo usermod -aG wheel greaterdemon

Summary

In this lab, we journeyed into the heart of Demon Hell to bend the rules of user management to our will. We learned to rename a user and move its home directory, as well as how to bestow additional powers by adding the user to a privileged group. This exercise not only provided a hands-on experience with the usermod command but also demonstrated the crucial role of user management even in the most unlikely of environments. Through mastering these tasks, one can harness the control required to maintain order in any system — be it on Earth or in the underworld.

Other Linux Tutorials you may like