Linux File Permissions

Linux File Permissions

Task

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 3 in Stratos Datacenter.

Please give executable permissions to /tmp/xfusioncorp.sh script on App Server 3. Also make sure every user can execute it.

Information

We have access to credentials servers from the infrastructure details:

Implementation

  1. Starting from a jump_host we ssh into App Server 3 as the user banner:

In the /tmp directory we can view the current permissions and ownership of the /tmp/xfusioncorp.sh file. We can see that it belongs to root user and it has not been made executable:

  1. Make xfusioncorp.sh executable for all everyone (users, groups, other):

  1. Make xfusioncorp.sh readable. A script can't be executed if it can't be read - at least for Bourne (again) shells I believe? Let's give read access to everyone and see the contents of the script.

  1. Execute the script:

Learning Takeaways

  1. Does a script file need to be readable? I guess all the script files I have ever written or run have always had read permissions set. I guess since a script is a text file it would require this permission, while binary files would not.

Did you find this article valuable?

Support cdrani by becoming a sponsor. Any amount is appreciated!