Below Fig: To verify myself, I ssh to tony@stapp01 > ssh to clint@stbkp01 > cd /backup > ls > [output: xfusioncorp_media.zip] > I unzipped the file to verify the contents, and everything was there.
Today I got this task again and it failed me again.
It seems that there is some problem in the task review algorithm or whatever it is called.
After running my script, I logged out of the AppServer 3 and logged In to the Nautilus Backup server to verify the file and, it was right there.
Then I clicked on the Check Task button and it failed me.
I don’t understand what is happening. Even if I put a Request Review on the task, there is no sense because the Task verification system has gone haywire.
Please look into this.
@Tej-Singh-Rana
Hi Tej,
If possible please check the reason behind this.
Hi @avnimahesh ,
Can you please share the review link? btw don’t worry about the points. If it’s a validation issue then I will mark pending for you. But at least give us the chance to review it.
I do not worry about the points, its just that I am getting confused if I am performing the task correctly or not.
Also, thank you for doing this for me.
Hi @avnimahesh ,
You are doing it correctly but we are expecting this from the sudo user, not from the root user of app server3.
Did you read this line?
Please make sure the script won't ask for a password while copying the archive file. Additionally, the respective server user (for example, tony in the case of App Server 1) must be able to run it.
You should have to run that script from the banner user and without interruption.
Okay. So yes, I created and ran the script from the root user on App Server 3 but it is not mentioned anywhere in the question to perform the tasks with the Normal user only. So even if the files that I created have a root ownership but I have added ‘rwx’ permission for other users as well. So anybody could access those files.
For the script to not ask for password, I did the following before running the script:
ssh keygen (Generated keygen for App Server 3)
ssh-copy-id clint@stbkp01 (Copied the keygen to Nautilus Backup server)
After all these things, I logged out of App S 3 and logged in to Nautilus backup server to check for the file, and it was there.
Then I logged out of the Backup Server and logged in as tony@stapp01 to check if tony is able to access and run the files, and he was but the task kept failing me.
Yes @Tej-Singh-Rana
I read point number d. very carefully and the commands I used, allows the script to run and execute successfully without asking for the password.
Now let me know if you have a solution or a rectification of this problem.
My steps are correct and I’m confident about it.
Hi,
Sorry for the delayed response.
So banner user also can run that script without facing any permission issues?
btw I marked this task pending for you. Please try from the sudo user.
Give it a try and let me know.
Do the same steps again from the root user and make the script executable and after that run it from the sudo user of that app server (Example:- app server01, it’s tony).
Let me know if you are able to run the script successfully.
I did all the steps even verified the zip archive on my own but the task failed still.
Here is what I did:
Logged -in to App Server 01 - ssh tony@stapp01
Changed to root user - sudo -i and then performed the below steps.
Created the script in /scripts on App Server 1 - vi touch /script/news_backup.sh
Commands in the script:
zip /backup/xfusioncorp_news.zip -r /var/www/html/news
scp /backup/xfusioncorp_news.zip clint@stbkp01:/backup
Made the script executable - chmod +x /script/news_backup.sh
Generated ssh keygen and copied keygen to Nautilus Backup server so that the script won’t ask for password - a) ssh-keygen b) ssh-copy-id clint@stbkp01
Finally, ran the script - sh /script/news_backup.sh
VERIFICATION
Logged in to App Server 3 to check if he is able to execute the .zip file or not - ssh banner@stapp03
Then ssh into Nautilus Backup server from App Server 3 - ssh clint@stbkp01
Changed the directory to /backup to access .zip file - cd /backup
Checked if zip package is installed or not - rpm -q zip
Installed zip using YUM - sudo yum install zip -y
Unzipped the .zip file, changed into /var/www/html/news dir and cat the output of index.html -
a) unzip xfusioncorp_news.zip b) cd /var/www/html/news c) cat index.html
→ Output of index.html
I also deleted the var dir from /backup so that the task may not fail again - rm -rf var/
Oh god! If Banner user on App Server 3 is able to run the file, tony user will have no problems at all in running, extracting or unzipping the file.
I added an executable (x) permission for others on the .zip file which means, other than File owner and group owner, other people could also access and open the file.
I don’t know what is being so hard to understand, my steps or the fault in KodeKloud’s system.