Linux Remote Copy - Wrong

Hello All , @Inderpreet @Ayman @kodekloud-support3

I am getting Permission Denied .
Please let me what wrong here


I can see extra space between @ and 172 ip addr. That should be like [email protected]

As per hint if you will face scp command is not found error then you have to install openssh-clients package in app server 3 as per task description.

Because of space between remote username and IP, if you notice the shell uses jump host user to connect to App03 which is causing the issue for you on authentication i believe. As you might be entering password for banner user but system picked local which is thor for scp.

Thank you @Tej-Singh-Rana
I also noticed it
Task is Success

Thank you @smartclick
I also noticed it
Task is Success

1 Like


Hi Team, iam getting permission denied message i gave full permissions for nautilus.txt.gdg with chmod 777 .

thor@jump_host /tmp$ scp nautilus.txt.gpg [email protected]:/home/data
The authenticity of host ‘172.16.238.12 (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 ‘172.16.238.12’ (ECDSA) to the list of known hosts.
[email protected]’s password:
scp: /home/data/nautilus.txt.gpg: Permission denied

@Inderpreet @Ayman @kodekloud-support3 Any update on this?

Task completed successfully with below steps.

$ chmod 777 /tmp/nautilus.txt.gpg

$ sudo scp /tmp/nautilus.txt.gpg [email protected]:/tmp

ssh steve@stapp02

ls -al

sudo cp /tmp/nautilus.txt.gpg /home/appdata

ls -al

exit

2 Likes

You may need to install openssh-clients for ssh based operations.

How to do this …I have entered sudo apt-get install openssh-client …so the are saying Command not found. Is this necessary to do …???

I only complete the task when transfer file to tmp dir and locally copy to right dir.

1 Like

The remote directory is owned by root so you can’t use scp to transfer file directly into it. The simplest way is to use temporary destination with scp and then move the file. Another way is to use ansible copy module :slight_smile:

@abhipatil99 that’s because it’s Centos and you should to use yum package manager. Learn the difference between Debian based and RHEL based distributions.

2 Likes

Login to the app-3 node
switch to root user
# sudo su -
create a folder inside the /tmp
# mkdir /tmp/test
change the permission
# chmod -R 777 /tmp/test

Copy the file from jump host to app3 node

In Jump host
# cd /tmp
# scp nautilus.txt.gdg user@<app3-node-ip/hostname>:/tmp/test
Login to the app3 node
# cd /tmp/test
# cp nautilus.txt.gdg /home/webapp
delete the test folder from /tmp
# rm -rf /tmp/test

2 Likes

@abhipatil99 you should use “yum install -y openssh-clients” command to install this package on centos.

1 Like

Tutorial with screenshots for beginners: Linux Remote Copy KodeKloud Solution

Hello, shawon10
Kindly update your copyrights year. It’s 2020 not 2014.

thanks it’s worked fine

You can also change the permission of /home/webapp on app03 instead of copying into tmp first.

hey guys,

follow the below steps

JUMP SERVER

1  scp /tmp/nautilus.txt.gpg steve@stapp02:/home/nfsdata/
2  ssh steve@stapp02
3  scp /tmp/nautilus.txt.gpg steve@stapp02:/home/nfsdata/

APP SERVER

1  ls -la /home/                           --HERE CHECKED NFSDATA FOLDER OWNER  AND IN NEXT STEP CHANGED TO STEVE AS OWNER 
2  sudo chown -R steve:steve /home/
3  ls -la /home/
4  cd /home/nfsdata/
5  ls

scp /tmp/nautilus.txt.gpg banner@stapp03:/home/webapp/nautilus.txt.gpg