DEV Community

Cover image for 9.Script Execution Permissions
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

9.Script Execution Permissions

Lab Information

In a bid to automate backup processes, the xFusionCorp Industries sysadmin team has developed a new bash script named xfusioncorp.sh. While the script has been distributed to all necessary servers, it lacks executable permissions on App Server 2 within the Stratos Datacenter.

Your task is to grant executable permissions to the /tmp/xfusioncorp.sh script on App Server 2. Additionally, ensure that all users have the capability to execute it.

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 2
ssh steve@stapp02.stratos.xfusioncorp.com

Password:

Am3ric@

πŸ”Ή Step 3: Switch to root (safer for permission changes)

sudo -i
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 4: Grant execute permission to all users

ls -l /tmp/xfusioncorp.sh
chmod 755 /tmp/xfusioncorp.sh
Enter fullscreen mode Exit fullscreen mode

πŸ”Ή Step 5: Verify permissions

ls -l /tmp/xfusioncorp.sh
Enter fullscreen mode Exit fullscreen mode

Expected output should show:

-rwxr-xr-x

The important part is:

x (execute bit) for user, group, and others

βœ… Final Checklist

βœ” Script exists at /tmp/xfusioncorp.sh
βœ” Execute permission added
βœ” All users can execute
βœ” Verified using ls -l
βœ” Completed on App Server 2 only


🧠 Part 2: Simple Step-by-Step Explanation (Beginner Friendly)
πŸ”Ή What is the problem?

The script:

/tmp/xfusioncorp.sh

exists, but cannot be executed because it lacks the execute (x) permission.

πŸ”Ή Why use chmod 755?

Breakdown:

πŸ”Ή What does 755 mean?

Numeric permissions:

Number Meaning
7 rwx (read, write, execute)
5 r-x (read, execute)

So:

755

means:

Owner β†’ full control

Group β†’ read & execute

Others β†’ read & execute

πŸ”Ή Why is execute permission important?

Without x, even if the script contains valid bash code, running:

./xfusioncorp.sh

will result in:

Permission denied


Resources & Next Steps
πŸ“¦ Full Code Repository: KodeKloud Learning Labs
πŸ“– More Deep Dives: Whispering Cloud Insights - Read other technical articles
πŸ’¬ Join Discussion: DEV Community - Share your thoughts and questions
πŸ’Ό Let's Connect: LinkedIn - I'd love to connect with you

Credits
β€’ All labs are from: KodeKloud
β€’ I sincerely appreciate your provision of these valuable resources.

Top comments (0)