# Tree
/company/
βββ executive
βΒ Β βββ financial
βΒ Β βΒ Β βββ payroll_data.txt
βΒ Β βΒ Β βββ Q4_2025_budget.txt
βΒ Β βββ strategy
βΒ Β βββ business_plan_2026.txt
βββ hr
βΒ Β βββ employee_records
βΒ Β βΒ Β βββ employee_contracts.txt
βΒ Β βΒ Β βββ salary_information.txt
βΒ Β βββ recruitment
βΒ Β βββ job_openings.txt
βββ intern
βΒ Β βββ learning
βΒ Β βββ practice_exercises.txt
βΒ Β βββ tutorial_notes.txt
βββ marketing
βΒ Β βββ campaigns
βΒ Β βΒ Β βββ Q1_2026_campaign.txt
βΒ Β βββ content
βΒ Β βββ blog_post_ideas.txt
βββ projects
βΒ Β βββ backend
βΒ Β βΒ Β βββ api_development.txt
βΒ Β βββ frontend
βΒ Β βΒ Β βββ homepage_redesign.txt
βΒ Β βββ fullstack
βΒ Β βΒ Β βββ client_portal.txt
βΒ Β βββ mobile
βΒ Β βββ android_app.txt
βββ readme.md
βββ shared
βΒ Β βββ general
βΒ Β βΒ Β βββ announcements.txt
βΒ Β βΒ Β βββ company_handbook.txt
βΒ Β βββ meeting_notes
βΒ Β βββ weekly_standup_notes.txt
βββ testing
βββ reports
βΒ Β βββ bug_report_001.txt
βββ staging
βββ test_environment_setup.txtWelcome! This project demonstrates how to design, build, and secure a complete Linux system infrastructure from the ground up. We created a realistic company environment for TheIdealDevs β a fictional IT solutions company based in Lalitpur, Nepal.
What makes this project special:
- β Real-world company scenario with 12 employees across 8 departments
- β Hands-on implementation of cybersecurity principles
- β Complete documentation for learners at any level
- β Production-ready security configurations
Whether you're a beginner learning Linux, a student studying cybersecurity, or a professional refreshing your sysadmin skills β this project will teach you practical, job-ready techniques.
| Component | Details |
|---|---|
| Company | TheIdealDevs (IT Solutions) |
| Location | Natole, Lalitpur, Nepal |
| Users Created | 12 employees with unique roles |
| Groups Configured | 8 department-based groups |
| Directory Structure | 23 directories mimicking real company layout |
| Files Created | 18 sample files (employee data, projects, policies) |
| Operating System | Kali Linux on VirtualBox |
| Security Status | β Fully secured with least privilege access |
| Department | Members | Access Level | Purpose |
|---|---|---|---|
| Executive | Saksham (CEO), Amy (CFO/CTO) | High - Confidential | Strategic planning, financials |
| Development | Suman, Amrit, Sushank, Kushal | Collaborative | Software projects, code repositories |
| QA | David | Department-specific | Testing, quality assurance |
| Marketing | Aadarsh | Collaborative | Campaigns, content, analytics |
| HR | Richard | High - Confidential | Employee records, policies |
| Intern | Ramesh | Limited - Learning | Training materials, sandboxed access |
| Staff | Isha | Basic - General | Reception, shared resources |
| SysAdmin | Loki | Full System Access | Infrastructure management |
By following this project, you'll master:
- β User & Group Management β Creating, modifying, and organizing users
- β File Permissions β Understanding octal (755) and symbolic (rwxr-xr-x) notation
- β
Access Control β Using
chmodandchownfor security - β Directory Design β Building logical, scalable file structures
- β Security Auditing β Verifying and testing access controls
- β Principle of Least Privilege β Users get only what they need
- β Role-Based Access Control (RBAC) β Permissions based on job functions
- β Department Isolation β HR can't see dev files, devs can't access HR data
- β Defense in Depth β Multiple security layers
- β Need-to-Know Basis β Sensitive data restricted appropriately
- β Technical Documentation β Writing clear, comprehensive guides
- β System Planning β Designing infrastructure before implementation
- β Problem-Solving β Troubleshooting permission issues
- β Best Practices β Industry-standard security approaches
- OS: Kali Linux (VirtualBox VM on Windows 11 Pro)
- Hardware: Acer Nitro V15 (RTX 3050, 16GB DDR5)
- Shell: Bash
- Tools:
useradd,groupadd,chmod,chown,tree,getent,su - Concepts: Linux permissions, user management, RBAC, security auditing
Want to replicate this project? Follow these condensed steps:
# Use any Linux distribution (Ubuntu, Kali, Debian, etc.)
# VirtualBox recommended for isolated testingsudo mkdir /company
cd /companysudo useradd -m -s /bin/bash -c "Saksham Sharma - CEO" saksham
sudo passwd saksham
# Repeat for all 12 users... sudo groupadd executives
sudo groupadd developers
sudo groupadd hr
# Create all 8 groups...sudo usermod -aG executives saksham
sudo usermod -aG developers suman
# Assign all users to appropriate groups...sudo mkdir -p /company/executive/financial
sudo mkdir -p /company/projects/frontend
sudo mkdir -p /company/hr/employee_records
# Create all 23 directories...sudo chmod 750 /company/executive/
sudo chown root:executives /company/executive/
sudo chmod 770 /company/projects/
sudo chown root:developers /company/projects/
# Configure all directory permissions...echo "Q4 Financial Report" | sudo tee /company/executive/financial/budget.txt
sudo chmod 640 /company/executive/financial/budget.txt
# Create sample files for realism...# View structure
tree /company/
# Test access as different users
sudo su - ramesh
cd /company/executive/ # Should be denied β
exitπ For detailed step-by-step commands, see the Command Reference below.
/company/
βββ executive/
β βββ financial/
β β βββ budget.txt (640 - rw-r-----)
β β βββ revenue.txt
β βββ strategy/
β βββ roadmap.txt
βββ projects/
β βββ frontend/
β β βββ app.js
β βββ backend/
β β βββ api.py
β βββ docs/
β βββ architecture.md
βββ testing/
β βββ test_cases.txt
β βββ bug_reports.txt
βββ marketing/
β βββ campaigns/
β β βββ social_media.txt
β βββ analytics/
β βββ metrics.txt
βββ hr/
β βββ employee_records/
β β βββ employee_data.txt (600 - rw-------)
β βββ policies/
β β βββ code_of_conduct.txt
β βββ payroll/
β βββ salary_info.txt
βββ intern/
β βββ training/
β β βββ onboarding.txt
β βββ assignments/
β βββ task_list.txt
βββ shared/
βββ handbook. txt
βββ announcements.txt
βββ resources/
Total: 23 directories, 18 files
Users receive only the minimum access required for their role.
- Interns can't access executive financial data
- Developers can't view HR employee records
- Marketing can't modify development code
Permissions are group-based, not individual.
- All developers share access to
/company/projects/ - All executives share access to
/company/executive/ - Changes to one group affect all members (easier management)
Sensitive departments are protected from unauthorized access.
- HR directory:
750permissions, onlyhrgroup can read - Executive directory:
750permissions, onlyexecutivesgroup can read - Testing directory: Only QA team has full access
Teams can work together in shared directories.
- Developers:
770on/company/projects/β all devs can read/write/execute - Marketing:
770on/company/marketing/β team collaboration enabled
Multiple layers of security controls:
- User authentication (passwords)
- Group membership (authorization)
- Directory permissions (access control)
- File permissions (data protection)
We organized all commands by category for easy reference. Click any section to expand.
π€ User Management Commands
sudo useradd -m -s /bin/bash -c "Full Name - Role" usernameFlags Explained:
sudoβ Execute with administrative privilegesuseraddβ Command to create a new user-mβ Create home directory (/home/username)-s /bin/bashβ Set default shell to Bash-c "comment"β Add descriptive comment (usually name and role)usernameβ The login name for the user
Example:
sudo useradd -m -s /bin/bash -c "Saksham Sharma - CEO" sakshamsudo passwd usernameExample:
sudo passwd saksham
# Enter password when promptedid username # Show user ID, groups, and GIDs
cat /etc/passwd | grep username # Show user entry in passwd file
getent passwd username # Get user entry from system databaseExamples:
id saksham
cat /etc/passwd | grep saksham
getent passwd sakshamsudo userdel username # Delete user (keeps home directory)
sudo userdel -r username # Delete user and home directoryπ₯ Group Management Commands
sudo groupadd groupnameExample:
sudo groupadd developerssudo usermod -aG groupname usernameFlags Explained:
usermodβ Modify user account-aβ Append (add without removing from other groups)-G groupnameβ Specify the group to add user tousernameβ The user to modify
Example:
sudo usermod -aG developers sumangroups username # Show all groups a user belongs to
getent group groupname # Show all members of a group
cat /etc/group | grep groupname # View group entry in group file
id username # Shows user's groups with GIDsExamples:
groups suman
getent group developers
cat /etc/group | grep developersUnderstanding getent:
getent= "Get Entry" from system databasesgetent group groupnameβ Get group information and list all membersgetent passwd usernameβ Get user information from passwd database
sudo groupdel groupnameπ Directory & File Management Commands
sudo mkdir directory_name # Create single directory
sudo mkdir -p /path/to/nested/directory # Create with parent directoriesFlags Explained:
mkdirβ Make directory-pβ Create parent directories as needed (no error if exists)
Examples:
sudo mkdir /company
sudo mkdir -p /company/executive/financialsudo touch filename # Create empty file
echo "content" | sudo tee filename # Create file with contentExamples:
sudo touch /company/hr/employee_data.txt
echo "Company Handbook" | sudo tee /company/shared/handbook.txtls # List files
ls -l # Long format (permissions, owner, size, date)
ls -a # Show hidden files
ls -la # Long format including hidden files
ls -ld /path/ # Show directory itself (not contents)
ls -lR /path/ # Recursive (show all subdirectories)
tree /path/ # Visual tree structure (if installed)Examples:
ls -l /company/
ls -ld /company/executive/
ls -lR /company/
tree /company/sudo apt update
sudo apt install treecat filename # Display entire file
head filename # Show first 10 lines
tail filename # Show last 10 lines
less filename # View file page by page (press 'q' to quit)π Permission Management Commands
sudo chmod 755 /path/ # rwxr-xr-x
sudo chmod 750 /path/ # rwxr-x---
sudo chmod 770 /path/ # rwxrwx---
sudo chmod 644 filename # rw-r--r--
sudo chmod 640 filename # rw-r-----
sudo chmod 660 filename # rw-rw----
sudo chmod -R 750 /path/ # Recursive (apply to all contents)chmod u+rwx file # Give owner read+write+execute
chmod g+rx file # Give group read+execute
chmod o-rwx file # Remove all permissions from others
chmod g+w file # Add write permission to group
chmod a+r file # Give read to all (owner+group+others)
chmod u=rwx,g=rx,o=r file # Set exact permissions| Octal | Symbolic | Use Case |
|---|---|---|
755 |
rwxr-xr-x |
Public directories, executable files |
750 |
rwxr-x--- |
Department directories (group access only) |
770 |
rwxrwx--- |
Collaborative team directories |
700 |
rwx------ |
Private directories (owner only) |
644 |
rw-r--r-- |
Public readable files |
640 |
rw-r----- |
Group readable files |
660 |
rw-rw---- |
Collaborative team files |
600 |
rw------- |
Private files (owner only) |
Examples:
sudo chmod 750 /company/hr/
sudo chmod -R 770 /company/projects/
sudo chmod 640 /company/executive/financial/budget.txtOctal to Symbolic Conversion:
| Octal | Binary | Symbolic | Meaning |
|---|---|---|---|
7 |
111 |
rwx |
Read + Write + Execute |
6 |
110 |
rw- |
Read + Write |
5 |
101 |
r-x |
Read + Execute |
4 |
100 |
r-- |
Read only |
3 |
011 |
-wx |
Write + Execute |
2 |
010 |
-w- |
Write only |
1 |
001 |
--x |
Execute only |
0 |
000 |
--- |
No permissions |
Calculating Octal Permissions:
- Read (r) = 4
- Write (w) = 2
- Execute (x) = 1
Example: rwxr-x--- to octal
rwx = 4+2+1 = 7
r-x = 4+0+1 = 5
--- = 0+0+0 = 0
Result: 750
Example: 644 to symbolic
6 = 4+2 = rw-
4 = 4 = r--
4 = 4 = r--
Result: rw-r--r--
π Ownership Management Commands
sudo chown user:group /path/ # Change both user and group
sudo chown user /path/ # Change user only
sudo chown : group /path/ # Change group only
sudo chown -R user:group /path/ # Recursive (all contents)Flags Explained:
chownβ Change ownership-Rβ Recursive (apply to directory and all its contents)user:groupβ New owner: group (colon separates them)
Examples:
sudo chown root:executives /company/executive/
sudo chown -R root:developers /company/projects/
sudo chown : hr /company/hr/employee_records/sudo chgrp groupname /path/ # Change group
sudo chgrp -R groupname /path/ # Recursiveπ System Audit Commands
ls -l /path/ # List with permissions and ownership
ls -ld /path/ # Show directory itself
ls -lR /path/ # Recursive listing
stat /path/ # Detailed file/directory statisticsgroups username # Show user's groups
getent group groupname # Show group members
id username # Detailed user/group info with IDs
cat /etc/group # View entire group filecat /etc/passwd | grep username # Find user in passwd file
cat /etc/group | grep groupname # Find group in group file
grep -E "user1|user2" /etc/passwd # Search for multiple usersUnderstanding System Files:
/etc/passwdβ Contains all user accounts/etc/groupβ Contains all groups and their members/etc/shadowβ Contains encrypted passwords (root access only)
π User Switching & Testing Commands
su - username # Switch to another user (with their environment)
su username # Switch without loading environment
exit # Return to previous userExamples:
su - suman # Switch to suman's account
cd /company/projects/ # Test if suman can access this
exit # Return to your accountsudo su - # Switch to root with root's environment
sudo -i # Switch to root (alternative method)
sudo su # Switch to root without environment
exit # Return to regular userDifferences:
sudo su -orsudo -iβ Full root environment (recommended)sudo suβ Root privileges but keeps current environmentsu -requires root password (unless using sudo)
# Switch to a user
sudo su - ramesh
# Try to access restricted directory
cd /company/executive/financial/
# If denied: Permission denied β
(security working)
# If allowed: Access granted β
(authorized user)
# Return to your account
exitπ² Advanced Directory Navigation
tree /path/ # Show visual tree structure
tree -L 2 /path/ # Limit depth to 2 levels
tree -d /path/ # Show directories only
tree -p /path/ # Show permissions
tree -pu /path/ # Show permissions and ownerExamples:
tree /company/
tree -L 2 /company/
tree -pu /company/executive/Why tree is Useful:
- Visual representation of directory structure
- Quickly see what files/folders exist
- Shows what you CAN access and CANNOT access
- Great for understanding the Filesystem hierarchy
# Switch to a user
sudo su - suman
# Navigate and view accessible structure
cd /company/
tree
# This will ONLY show directories suman can access
# Restricted directories won't appear or will show "Permission denied"
exitπ File Search Commands
find /path/ -name "filename" # Search by exact name
find /path/ -name "*.txt" # Search by pattern
find /path/ -type f # Find files only
find /path/ -type d # Find directories only
find /path/ -user username # Find files owned by user
find /path/ -group groupname # Find files owned by groupExamples:
find /company/ -name "*.txt"
find /company/ -type d
find /company/ -group developersgrep "search_term" filename # Search in single file
grep -r "search_term" /path/ # Recursive search
grep -i "search_term" filename # Case-insensitive searchβΉοΈ System Information Commands
whoami # Show current username
id # Show current user's ID and groupswho # Show who is logged in
w # Show who is logged in and what they're doing
last # Show login historydf -h # Show disk space usage
du -sh /path/ # Show directory size
du -h /path/ # Show size of all contentsπ Troubleshooting Commands
# Check permissions
ls -ld /path/
# Check ownership
ls -l /path/
# Check your groups
groups
# Check if you're in the required group
id | grep groupname# Can't enter directory but should be able to
sudo chmod +x /path/ # Add execute permission
# Group members can't write
sudo chmod g+w /path/ # Add group write permission
# Wrong group ownership
sudo chown : correct_group /path/ # Fix group ownershipβ‘ Project-Specific Quick Commands
sudo useradd -m -s /bin/bash -c "Saksham Sharma - CEO" saksham
sudo useradd -m -s /bin/bash -c "Amy Cooper - CFO & CTO" amy
sudo useradd -m -s /bin/bash -c "Richard Stallman - HR Manager" richard
sudo useradd -m -s /bin/bash -c "Suman Sharma - Frontend Engineer" suman
sudo useradd -m -s /bin/bash -c "Amrit Paudel - Backend Engineer" amrit
sudo useradd -m -s /bin/bash -c "Sushank Subedi - FullStack Engineer" sushank
sudo useradd -m -s /bin/bash -c "Kushal Pun - Mobile Developer" kushal
sudo useradd -m -s /bin/bash -c "David Oli - QA Engineer" david
sudo useradd -m -s /bin/bash -c "Aadarsh Dhami - Marketing Manager" aadarsh
sudo useradd -m -s /bin/bash -c "Ramesh Shahi - Intern" ramesh
sudo useradd -m -s /bin/bash -c "Isha Misha - Receptionist" isha
sudo useradd -m -s /bin/bash -c "Loki - System Administrator" lokisudo groupadd executives
sudo groupadd developers
sudo groupadd qa
sudo groupadd marketing
sudo groupadd hr
sudo groupadd interns
sudo groupadd staff
sudo groupadd sysadminssudo usermod -aG executives saksham
sudo usermod -aG executives amy
sudo usermod -aG developers suman
sudo usermod -aG developers amrit
sudo usermod -aG developers sushank
sudo usermod -aG developers kushal
sudo usermod -aG qa david
sudo usermod -aG marketing aadarsh
sudo usermod -aG hr richard
sudo usermod -aG interns ramesh
sudo usermod -aG staff isha
sudo usermod -aG sysadmins loki# View all company directories
ls -l /company/
# View all groups and members
getent group | grep -E "executives|developers|qa|marketing|hr|interns|staff|sysadmins"
# Complete system audit
ls -lR /company/
# Visual tree
tree /company/We tested our security implementation by:
# Test 1: Can intern access executive files?
sudo su - ramesh
cd /company/executive/financial/
# Result: Permission denied β
# Test 2: Can developers access project files?
sudo su - suman
cd /company/projects/
ls -la
# Result: Access granted β
# Test 3: Can HR manager access employee records?
sudo su - richard
cat /company/hr/employee_records/employee_data.txt
# Result: Access granted β
# Verify executive directory (should be 750)
ls -ld /company/executive/
# Expected: drwxr-x--- root executives
# Verify projects directory (should be 770)
ls -ld /company/projects/
# Expected: drwxrwx--- root developers
# Verify sensitive files (should be 640 or 600)
ls -l /company/executive/financial/budget.txt
# Expected: -rw-r----- root executives# Verify all developers are in developers group
getent group developers
# Expected: developers: x:1001:suman,amrit,sushank,kushal
# Verify all executives are in executives group
getent group executives
# Expected: executives:x:1000:saksham,amyResult: β All security controls functioning as designed
This project prepared us for:
- β Junior System Administrator β Managing users, groups, and permissions
- β IT Support Specialist β Troubleshooting access issues
- β Security Analyst β Understanding and implementing access controls
- β DevOps Engineer (Entry-level) β Linux infrastructure management
- β Cybersecurity Roles β Applying security principles in practice
- Linux command-line proficiency β
- User and permission management β
- Security best practices (least privilege, RBAC) β
- Technical documentation β
- Hands-on practical experience β
- ISO 27001 principles (access control, least privilege)
- NIST Cybersecurity Framework (identity management, access control)
- CIS Controls (controlled use of administrative privileges)
- β Always apply the principle of least privilege
- β Use groups for permission management (not individual users)
- β Regularly audit permissions and group memberships
- β
Remove execute permissions from regular files (use
640not750) - β
Keep sensitive directories at
750or stricter (700,710) - β
Use
755for shared/public directories - β Document all permission changes
- β Test access controls after making changes
- β
Always use
sudofor system-wide changes - β
Use
-Rflag carefully (it affects all subdirectories) - β
Verify changes with
ls -lafter modifications - β
Use
getentfor clean group/user information - β
Test permissions by switching users (
su - username) - β
Use
treefor quick visual understanding - β Keep backups before making major permission changes
| Metric | Value |
|---|---|
| Total Users | 12 |
| Total Groups | 8 |
| Total Directories | 23 |
| Total Files | 18 |
| Security Status | β Fully Secured |
| Access Control | β Functioning |
| Audit Status | β Passed |
| Production Ready | β Yes |
- β User and group management in Linux
- β File permissions (symbolic and octal notation)
- β
Using
chmodandchowneffectively - β Directory structure design
- β Access control implementation
- β System auditing techniques
- β Principle of least privilege
- β Role-based access control (RBAC)
- β Department isolation
- β Collaborative workspace design
- β Security auditing methodology
- β Technical documentation writing
- β Project planning and execution
- β Security-first thinking
- β Problem-solving approach
- β Attention to detail
If you found this project helpful or have questions:
- π GitHub: UnExplainableFish52
- πΌ LinkedIn: Saksham Sharma
- π§ Email: loki@saksham.info.np , info@sakshamsharma.com.np
- π Portfolio: Saksham Sharma's Profile
- Google Cybersecurity Professional Certificate β For foundational security principles
- Linux Documentation Project β Comprehensive command references
- TheIdealDevs Team β Fictional but inspired by real company structures
- Open Source Community β For tools like
tree,bash, and VirtualBox
Status: β
COMPLETE
Security: β
FULLY SECURED
Documentation: β
COMPREHENSIVE
Production Ready: β
YES
Built by Saksham Sharma | UnExplainableFish52 | loki | System Administrator Enthusiast & Cyber Security Specialist
End of Documentation