Lab Information
Due to an accidental data mix-up, user data was unintentionally mingled on Nautilus App Server 3 at the /home/usersdata location by the Nautilus production support team in Stratos DC. To rectify this, specific user data needs to be filtered and relocated. Here are the details:
Locate all files (excluding directories) owned by user mark within the /home/usersdata directory on App Server 3. Copy these files while preserving the directory structure to the /blog directory.
Lab Solutions
π§ Part 1: Lab Step-by-Step Guidelines (Technical Execution)
πΉ Step 1: Log in to Jump Host
ssh thor@jump_host.stratos.xfusioncorp.com
Password:
mjolnir123
πΉ Step 2: SSH into App Server 3
ssh banner@stapp03.stratos.xfusioncorp.com
Password:
BigGr33n
πΉ Step 3: Switch to Root
sudo -i
πΉ Step 4: Move into source directory
β οΈ This step is critical for correct directory structure preservation.
cd /home/usersdata
πΉ Step 5: Copy files owned by mark (files only)
find . -type f -user mark -exec cp --parents {} /blog \;
β . ensures relative path
β -type f excludes directories
β --parents preserves directory structure
β Files copied under /blog correctly
πΉ Step 6: Verify copied files
find /blog -type f
β Final Checklist
β Executed on App Server 3 only
β Source: /home/usersdata
β Only files selected (-type f)
β Ownership filter: mark
β Directory structure preserved
β Files copied into /blog
β Verified successfully
π§ Part 2: Simple Step-by-Step Explanation (Beginner Friendly)
πΉ What is the task really asking?
Inside this directory:
/home/usersdata
There are files belonging to multiple users.
Your job is to:
Find only the files owned by user mark
Ignore directories
Copy those files
Keep their folder structure
Place them inside /blog
We are not moving, only copying.
πΉ Why do we use find?
Because we need to filter files based on:
Ownership (mark)
File type (files only, not folders)
Location (/home/usersdata)
The find command allows very precise filtering.
πΉ Why -type f?
-type f means:
Select files only.
If we donβt use this, directories might also be selected β which the lab does NOT want.
πΉ Why -user mark?
This ensures we only touch files owned by:
mark
Files owned by root, steve, or anyone else are ignored.
πΉ Why do we cd /home/usersdata first?
This is extremely important.
If we run:
find /home/usersdata ...
Then --parents will recreate the full path:
/blog/home/usersdata/...
That is usually NOT what the lab checker expects.
But if we do:
cd /home/usersdata
find .
Then the structure copied will look like:
/blog/
That is correct.
πΉ What does cp --parents do?
Normally, copying a file like:
project1/app/file.txt
Would place it directly into /blog like:
/blog/file.txt
But --parents preserves the full directory path, so it becomes:
/blog/project1/app/file.txt
This keeps the original structure intact.
πΉ Why must we run as root?
Because:
Some files may not be readable by normal users
Permission restrictions may block copying
Root avoids permission-related silent failures
πΉ Important Clarification About Ownership
When root copies files:
The copied files usually become owned by root
This is normal
The lab usually checks file presence and structure, not ownership
So donβt panic if:
find /blog -type f -user mark
returns nothing.
Instead check:
find /blog -type f
πΉ What Should Exist After Success?
If original file was:
/home/usersdata/site/config/settings.php
Then after copy, you should see:
/blog/site/config/settings.php
Same structure β different root directory.
π Why This Task Matters (Real-World Context)
This simulates:
Data recovery after accidental mixing
Filtering files by ownership
Migrating specific user data
Maintaining application directory integrity
These are common DevOps and production support tasks.
Top comments (0)