Linux Bash Scripts task

how to verify if all the steps are done correctly for this task?

  1. running the script from root is causing failure, will run it from tony/steve/banner user

ssh banner@stapp03
The authenticity of host ‘stapp03 (172.16.238.12)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stapp03,172.16.238.12’ (ECDSA) to the list of known hosts.
banner@stapp03’s password:
[banner@stapp03 ~]$ 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 banner:
[root@stapp03 banner]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Created directory ‘/root/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:GiGNRFTipX1/MzxFOr8TAPARnumj7/QBhZEXV9dlrog root@stapp03
The key’s randomart image is:
±–[RSA 2048]----+
| o=.o …=o…o.B|
| o B o.B.+ oo|
| = + . *.= . .|
| . o o + * . |
| . S E B + |
| o . + + o |
| . . . . o |
| o . . . |
| .o . |
±—[SHA256]-----+
[root@stapp03 banner]# ssh-copy-id clint@stbkp01
/bin/ssh-copy-id: INFO: Source of key(s) to be installed: “/root/.ssh/id_rsa.pub”
The authenticity of host ‘stbkp01 (172.16.238.16)’ can’t be established.
ECDSA key fingerprint is SHA256:00s+COQ/Ir0HFI4OX2RwOj5xkHbXMFE/ApAj/SjSlYU.
ECDSA key fingerprint is MD5:7b:2c:ce:24:03:c6:e3:0a:f0:d9:1a:42:6b:76:6f:42.
Are you sure you want to continue connecting (yes/no)? yes
/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed – if you are prompted now it is to install the new keys
clint@stbkp01’s password:

Number of key(s) added: 1

Now try logging into the machine, with: “ssh ‘clint@stbkp01’”
and check to make sure that only the key(s) you wanted were added.

[root@stapp03 banner]# vi news_backup.sh
[root@stapp03 banner]# ./news_backup.sh
bash: ./news_backup.sh: Permission denied
[root@stapp03 banner]# cd scripts
bash: cd: scripts: No such file or directory
[root@stapp03 banner]# mkdir /scripts
mkdir: cannot create directory ‘/scripts’: File exists
[root@stapp03 banner]# cd /scripts
[root@stapp03 scripts]# ls -al
total 8
drwxrwxrwx 2 root root 4096 Aug 18 02:22 .
drwxr-xr-x 1 root root 4096 Aug 18 02:22 …
[root@stapp03 scripts]# cd …
[root@stapp03 /]# cd banner
bash: cd: banner: No such file or directory
[root@stapp03 /]# vi news_backup.sh
[root@stapp03 /]# cd /scripts/scripts
bash: cd: /scripts/scripts: No such file or directory
[root@stapp03 /]# /cd /scripts
bash: /cd: No such file or directory
[root@stapp03 /]# cd /scripts
[root@stapp03 scripts]# vi news_backup.sh
[root@stapp03 scripts]# chmod +x news_backup.sh
[root@stapp03 scripts]# sh news_backup.sh
adding: var/www/html/news/ (stored 0%)
adding: var/www/html/news/.gitkeep (stored 0%)
adding: var/www/html/news/index.html (stored 0%)
xfusioncorp_news.zip 100% 588 799.4KB/s 00:00
[root@stapp03 scripts]# ls -al
total 12
drwxrwxrwx 2 root root 4096 Aug 18 02:38 .
drwxr-xr-x 1 root root 4096 Aug 18 02:35 …
-rwxr-xr-x 1 root root 123 Aug 18 02:38 news_backup.sh
[root@stapp03 scripts]# ssh clint@stbkp01
[clint@stbkp01 ~]$ ls /backup/ xfusioncorp_news.zip
ls: cannot access xfusioncorp_news.zip: No such file or directory
/backup/:
xfusioncorp_news.zip
[clint@stbkp01 ~]$ ls /backup/
xfusioncorp_news.zip
[clint@stbkp01 ~]$ ls -al /backup/
total 12
drwxrwxrwx 2 root root 4096 Aug 18 02:39 .
drwxr-xr-x 1 root root 4096 Aug 18 02:22 …
-rw-r–r-- 1 clint clint 588 Aug 18 02:39 xfusioncorp_news.zip
[clint@stbkp01 ~]$ exit
logout
Connection to stbkp01 closed.
[root@stapp03 scripts]# exit
exit
[banner@stapp03 ~]$ exit
logout
Connection to stapp03 closed.
thor@jump_host /$ ssh clint@stbkp01
The authenticity of host ‘stbkp01 (172.16.238.16)’ can’t be established.
ECDSA key fingerprint is SHA256:00s+COQ/Ir0HFI4OX2RwOj5xkHbXMFE/ApAj/SjSlYU.
ECDSA key fingerprint is MD5:7b:2c:ce:24:03:c6:e3:0a:f0:d9:1a:42:6b:76:6f:42.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stbkp01,172.16.238.16’ (ECDSA) to the list of known hosts.
clint@stbkp01’s password:
Permission denied, please try again.
clint@stbkp01’s password:
Last login: Tue Aug 18 02:40:49 2020 from stapp03
[clint@stbkp01 ~]$ sudo -i

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 clint:
[root@stbkp01 ~]# ls /backup/
xfusioncorp_news.zip
[root@stbkp01 ~]# exit
logout
[clint@stbkp01 ~]$ exit
logout
Connection to stbkp01 closed.
thor@jump_host /$ ssh clint@stbkp01
clint@stbkp01’s password:
Last login: Tue Aug 18 02:44:59 2020 from jump_host.linuxbashscripts_app_net
[clint@stbkp01 ~]$ ls /backup/
xfusioncorp_news.zip
[clint@stbkp01 ~]$ exit
logout
Connection to stbkp01 closed.
thor@jump_host /$ ssh clint@stbkp01
clint@stbkp01’s password:
Last login: Tue Aug 18 02:50:15 2020 from jump_host.linuxbashscripts_app_net
[clint@stbkp01 ~]$ ssh banner@stapp02
The authenticity of host ‘stapp02 (172.16.238.11)’ can’t be established.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
ECDSA key fingerprint is SHA256:SySamszyWhhLGFiybhGBqfrr8g55wS/3e37ZpBOvICs.
ECDSA key fingerprint is MD5:6d:31:18:2a:f9:07:f3:29:dd:0a:d3:1f:6e:04:0a:db.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stapp03,172.16.238.12’ (ECDSA) to the list of known hosts.
banner@stapp03’s password:
Last login: Tue Aug 18 02:24:42 2020 from jump_host.linuxbashscripts_app_net
[banner@stapp03 ~]$ cd /scripts
[banner@stapp03 scripts]$ sh news_backup.sh
zip I/O error: Permission denied
zip error: Could not create output file (/backup/xfusioncorp_news.zip)
The authenticity of host ‘stbkp01 (172.16.238.16)’ can’t be established.
ECDSA key fingerprint is SHA256:00s+COQ/Ir0HFI4OX2RwOj5xkHbXMFE/ApAj/SjSlYU.
ECDSA key fingerprint is MD5:7b:2c:ce:24:03:c6:e3:0a:f0:d9:1a:42:6b:76:6f:42.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added ‘stbkp01,172.16.238.16’ (ECDSA) to the list of known hosts.
clint@stbkp01’s password:
xfusioncorp_news.zip 100% 588 773.7KB/s 00:00
[banner@stapp03 scripts]$