Under the task 'Linux Bash Scripts'

Hey All,

Under the system admin role, my task is to create the bash script to zip the folder and copy into remote server. It should be pass wordless. so i have followed the below steps.

1.) I create passwordless ssh to remote by generating the key which is successful as well when connecting using ssh
2.) I wrote the simple bash to achieve it as below

#!/bin/bash

Create zip archive

zip -r /backup/xfusioncorp_media.zip /var/www/html/media

Transfer zip archive

scp /backup/xfusioncorp_media.zip clint@stbkp01:/backup/

When i check , the zip file is present in the remote server

However my verification fails

That`s because when you generate the reygen-key, I believe you are doing it as a root user.
Try being the normal user

1 Like

_ssh-keygen

Yes, I did the mistake of doing in root, normal user does the job, thanks buddy!

1 Like