In response to heightened security concerns, the xFusionCorp Industries security team has opted for custom Apache users for their web applications. Each user is tailored specifically for an application, enhancing security measures. Your task is to create a custom Apache user according to the outlined specifications:
a. Create a user named john on App server 3 within the Stratos Datacenter.
b. Assign a unique UID 1321 and designate the home directory as /var/www/john.
-
Log in to App Server 3: First, connect to the application server using SSH. Execute the following command from your local machine:
ssh banner@stapp03
Here,
banner
is the username you use to access the server, andstapp03
is the hostname of App Server 3. -
Switch to the Root User: Once logged in, escalate your privileges to the root user to perform administrative tasks. Use the following command:
sudo su
This command will prompt you for the root password or your user password, depending on your sudo configuration.
-
Create the User with a Specific UID: With root privileges, create a new user named john and assign a unique user ID (UID) of 1321. Run the following command:
useradd -u 1321 john
The
-u
option specifies the UID, andjohn
is the username. By default, this command creates a home directory for the user at/home/john
. -
Set the Custom Home Directory: Change the default home directory to
/var/www/john
. This step is necessary to align with the specified directory structure for web applications. Use the following command:usermod -d /var/www/john john
The
-d
option updates the user's home directory path. -
Verify the User Configuration: To ensure that the user john has been created with the correct UID and home directory, check the user information in the
/etc/passwd
file. Execute the following command:grep john /etc/passwd
You should see an output similar to:
john:x:1321:1321::/var/www/john:/bin/bash
In this output:
john
is the username.x
indicates that the password is managed through shadow files.1321
is the UID and GID (group ID)./var/www/john
is the home directory./bin/bash
is the default shell.