Script Execution Permissions Level 1 Linux KodeKloud Engineer Task Success

Ticker

6/recent/ticker-posts

Script Execution Permissions Level 1 Linux KodeKloud Engineer Task Success

 Question : 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 1 within the Stratos Datacenter.

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


Please Note :-  Perform the below commands based on your question  server,  user name & other details might differ . So please read task carefully before executing. All the Best 👍


Solution:  

1. Login on   App server as per the task

Server Name

IP

Hostname

User

Password

Purpose

stapp01

172.16.238.10

stapp01.stratos.xfusioncorp.com

tony

Ir0nM@n

App 1

stapp02

172.16.238.11

stapp02.stratos.xfusioncorp.com

steve

Am3ric@

App 2

stapp03

172.16.238.12

stapp03.stratos.xfusioncorp.com

banner

BigGr33n

App 3

thor@jump_host /$ ssh tony@stapp01

The authenticity of host 'stapp01 (172.16.238.10)' can't be established.

ECDSA key fingerprint is SHA256:RIRt2SqEVQ3yKDQ+cX5QLPw7mJNJhXUcT5Dpsy4GU1U.

ECDSA key fingerprint is MD5:bd:f7:14:9e:c0:fd:41:0d:2d:e4:30:47:8a:34:35:ae.

Are you sure you want to continue connecting (yes/no)? yes

Warning: Permanently added 'stapp01,172.16.238.10' (ECDSA) to the list of known hosts.

tony@stapp01's password:

[tony@stapp01 ~]$ sudo su -

 We trust you have received the usual lecture from the local System

Administrator. It usually boils down to these three things:

     #1) Respect the privacy of others.

    #2) Think before you type.

    #3) With great power comes great responsibility.

 [sudo] password for tony:

[root@stapp01 ~]#

2. List the file existing file permission     

[root@stapp01 ~]# ls -lsd /tmp/xfusioncorp.sh

4 ---------- 1 root root 40 Jul 23 10:25 /tmp/xfusioncorp.sh

[root@stapp01 ~]#


3. As per the task all other users need to have execute permission   

[root@stapp01 ~]# chmod o+rx /tmp/xfusioncorp.sh

[root@stapp01 ~]#


Please note that in case of bash script bash is the interpreter that is actually going to execute the script and the interpreter needs to read the script so even if you have given it only executable permission the interpreter i.e bash will not be able to execute it so you had to give it read permission as well along with execute permission.

[root@stapp01 ~]# cat /tmp/xfusioncorp.sh

#!/bin/bash

echo "Welcome To KodeKloud"

[root@stapp01 ~]#


4. Verify the file permissions and execute the script form user 

[root@stapp01 ~]#ls -lsd /tmp/xfusioncorp.sh

4 -------r-x 1 root root 40 Jul 23 10:25 /tmp/xfusioncorp.sh

[root@stapp01 ~]# exit

logout

[tony@stapp01 ~]$ sh /tmp/xfusioncorp.sh

Welcome To KodeKloud

[tony@stapp01 ~]$


5. Click on Finish & Confirm to complete the task successful

Happy Learning!!!!


Apart from this if you need more clarity,  I have made a  tutorial video on this , 

please go through and share your comments. Like and share the knowledge


Post a Comment

0 Comments

Latest Posts

Create IAM User Using Terraform Kodekloud Engineer Task Success