Linux User Data Transfer Level 1 Linux KodeKloud Engineer Task Success

Ticker

6/recent/ticker-posts

Linux User Data Transfer Level 1 Linux KodeKloud Engineer Task Success

 Question :  Due to an accidental data mix-up, user data was unintentionally mingled on Nautilus App Server 2 at the /home/usersdata location by the Nautilus production support team in Stratos DC. To rectify this, specific user data needs to be filtered and relocated. Here are the details:

Locate all files (excluding directories) owned by user jim within the /home/usersdata directory on App Server 2. Copy these files while preserving the directory structure to the /official directory..

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. At first login on App server   &  Switch to  root user 

thor@jump_host ~$ ssh tony@stapp01

The authenticity of host 'stapp01 (172.16.238.10)' can't be established.

ECDSA key fingerprint is SHA256:L7eZuubxoGQvmU+y/Y4oTcBchrTEEXJRICeutnhKj4c.

ECDSA key fingerprint is MD5:4b:24:ff:99:ed:fd:ac:56:28:05:99:f1:62:f4:d9:65.

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 files and folders in the given folder path in task

[root@stapp01 ~]# ls -l /home/usersdata/

total 224

-rw-r--r--  1 jim  root   405 Jul 14 12:17 index.php

-rw-r--r--  1 root root 19915 Jul 14 12:17 license.txt

-rw-r--r--  1 root root  7389 Jul 14 12:17 readme.html

-rw-r--r--  1 jim  root  7205 Jul 14 12:17 wp-activate.php

drwxr-xr-x  9 root root  4096 Jul 14 12:17 wp-admin

-rw-r--r--  1 jim  root   351 Jul 14 12:17 wp-blog-header.php

-rw-r--r--  1 jim  root  2338 Jul 14 12:17 wp-comments-post.php

-rw-r--r--  1 jim  root  3001 Jul 14 12:17 wp-config-sample.php

drwxr-xr-x  4 root root  4096 Jul 14 12:17 wp-content

-rw-r--r--  1 jim  root  5543 Jul 14 12:17 wp-cron.php

drwxr-xr-x 27 root root 12288 Jul 14 12:17 wp-includes

-rw-r--r--  1 jim  root  2494 Jul 14 12:17 wp-links-opml.php

-rw-r--r--  1 jim  root  3985 Jul 14 12:17 wp-load.php

-rw-r--r--  1 jim  root 49135 Jul 14 12:17 wp-login.php

-rw-r--r--  1 jim  root  8522 Jul 14 12:17 wp-mail.php

-rw-r--r--  1 jim  root 24587 Jul 14 12:17 wp-settings.php

-rw-r--r--  1 jim  root 34350 Jul 14 12:17 wp-signup.php

-rw-r--r--  1 jim  root  4914 Jul 14 12:17 wp-trackback.php

-rw-r--r--  1 jim  root  3236 Jul 14 12:17 xmlrpc.php

[root@stapp01 ~]# 

[root@stapp01 ~]# ls -l /official

total 0

[root@stapp01 ~]#

[root@stapp01 ~]# find /home/usersdata/ -type f -user jim |wc -l

1625

[root@stapp01 ~]#


3. As per the task find the files name by user & copy with folder structure 

[root@stapp01 ~]# find /home/usersdata/ -type f -user jim -exec cp --parents {} /official \;

[root@stapp01 ~]#

\
4. List the files copied in the destination folder given in task

[root@stapp01 ~]# ls -l /official/home/usersdata/

total 200

-rw-r--r--  1 root root   405 Jul 14 12:26 index.php

-rw-r--r--  1 root root  7205 Jul 14 12:26 wp-activate.php

drwxr-xr-x  7 root root  4096 Jul 14 12:26 wp-admin

-rw-r--r--  1 root root   351 Jul 14 12:26 wp-blog-header.php

-rw-r--r--  1 root root  2338 Jul 14 12:26 wp-comments-post.php

-rw-r--r--  1 root root  3001 Jul 14 12:26 wp-config-sample.php

drwxr-xr-x  4 root root  4096 Jul 14 12:26 wp-content

-rw-r--r--  1 root root  5543 Jul 14 12:26 wp-cron.php

drwxr-xr-x 23 root root 16384 Jul 14 12:26 wp-includes

-rw-r--r--  1 root root  2494 Jul 14 12:26 wp-links-opml.php

-rw-r--r--  1 root root  3985 Jul 14 12:26 wp-load.php

-rw-r--r--  1 root root 49135 Jul 14 12:26 wp-login.php

-rw-r--r--  1 root root  8522 Jul 14 12:26 wp-mail.php

-rw-r--r--  1 root root 24587 Jul 14 12:26 wp-settings.php

-rw-r--r--  1 root root 34350 Jul 14 12:26 wp-signup.php

-rw-r--r--  1 root root  4914 Jul 14 12:26 wp-trackback.php

-rw-r--r--  1 root root  3236 Jul 14 12:26 xmlrpc.php

[root@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

0 Comments

Latest Posts

Ansible Install Package Ansible Level 2 Ansible KodeKloud Engineer Task Success