Linux File Permissions

Ticker

6/recent/ticker-posts

Linux File Permissions

Question : There are new requirements to automate a backup process that was performed manually by the xFusionCorp Industries system admins team earlier. To automate this task, the team has developed a new bash script xfusioncorp.sh. They have already copied the script on all required servers, however they did not make it executable on one the app server i.e App Server 1 in Stratos Datacenter.

Please give executable permissions to /tmp/xfusioncorp.sh script on App Server 1. Also make sure every user can 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 -ltr /tmp/xfusioncorp.sh

---------- 1 root root 40 Jun 17 09:02 /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 -lrt /tmp/xfusioncorp.sh

-------r-x 1 root root 40 Jun 17 09: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

4 Comments

  1. where can i get app svr username pwd ? I dont see the task

    ReplyDelete
    Replies
    1. you can get on Wiki page left side menu tab click on link to get all server password https://kodekloudhub.github.io/kodekloud-engineer/docs/projects/nautilus. Feel free to chat online for instant response while doing task

      Delete
  2. a+rx instead of o+rx , it says all users !! { FREE PALESTINE }

    ReplyDelete
    Replies
    1. Thanks for comment. For all users you can used it.

      Delete

Latest Posts

KodeKloud Kubernetes Security CKS  Lab Challenge 4 |  Audit-policy | Install & configure falco utility | Inspect the API server audit logs and identify the user