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 yousuf on App server 3 within the Stratos Datacenter.
b. Assign a unique UID 1610 and designate the home directory as /var/www/yousuf.
Solution
Step 1: Connect to App Server 3
First, SSH into App Server 3 using the provided credentials. Based on typical infrastructure details:
ssh steve@stapp03
# Password: [password from the details page]
Step 2: Create the user with specified parameters
Use the useradd command with the appropriate options:
sudo useradd -u 1610 -d /var/www/yousuf -m yousuf
Command breakdown:
-
-u 1610: Sets the UID to 1610 -
-d /var/www/yousuf: Sets the home directory -
-m: Creates the home directory if it doesn't exist -
yousuf: The username
Step 3: Verify the user creation
Check if the user was created correctly:
# Verify user details
id yousuf
# Check the home directory
ls -la /var/www/yousuf
# Verify UID in /etc/passwd
grep yousuf /etc/passwd
Expected output should show:
- UID: 1610
- Home directory: /var/www/yousuf
- The user should belong to a group with the same name (default)
Step 4: Set proper permissions (optional but recommended)
Since this is for Apache, you might want to set appropriate permissions:
# Set ownership
sudo chown -R yousuf:yousuf /var/www/yousuf
# Set appropriate permissions (755 for directories, 644 for files)
sudo chmod 755 /var/www/yousuf
Complete Solution (All-in-One)
# Connect to App Server 3
ssh steve@stapp03
# Switch to root or use sudo
sudo su -
# Create the user
useradd -u 1610 -d /var/www/yousuf -m yousuf
# Verify
id yousuf
grep yousuf /etc/passwd
ls -ld /var/www/yousuf
Verification Checklist
- [ ] User
yousufexists on App Server 3 - [ ] UID is
1610 - [ ] Home directory is
/var/www/yousuf - [ ] Home directory was created successfully
Troubleshooting
If you encounter any issues:
-
"user already exists": Remove existing user with
sudo userdel -r yousufand recreate -
"directory already exists": Check permissions or use
-mflag to ensure proper ownership -
Permission denied: Use
sudofor all commands
This solution creates the custom Apache user as specified in the challenge requirements.
Top comments (0)