2

I have tried to copy some file in tomcat using SCP command

scp ubuntu@xxxxxxx:/opt/apache-tomcat-9.0.48/conf/server.xml .

ubuntu@xxxxxxx: Permission denied (publickey).

help me to get out this

Thank in advance :)

AKASH-29
  • 23
  • 1
  • 3
  • Are you trying to use a **live** or **persistent live** Ubuntu system as server? I'm asking because of the user name 'ubuntu'. In that case I think you need a user with a password (which can be created in a persistent live system). - Otherwise, **if the system is an installed system** with a user name 'ubuntu', you may need **key authentication**. Please ask the administrator (if it is not you). – sudodus Jun 26 '21 at 10:56
  • Are you connecting to an EC2 instance? – matigo Jun 26 '21 at 13:01
  • @matigo yes i have one master machine and one slave machine i just wanted to copy some file in a remote machine and pasting into my master machine – AKASH-29 Jun 26 '21 at 18:41
  • @sudodus yes it's literally a live machine before copying a file i just have checked the connectivity between them and it's working fine on a remote machine and paste it into my local machine it won't working on it it's not an authentication issue i think so – AKASH-29 Jun 26 '21 at 18:45
  • I have never used an EC2 instance, so I'm sorry, I cannot help you much. – sudodus Jun 26 '21 at 18:47

1 Answers1

3

Based on your answers in the comments, your servers are Amazon EC2 instances, which confirms that this very much is an authentication issue. You will need to use scp with the -i option and include the .pem that you use while SSHing into the machine:

scp -i ~/.ssh/amazon.pem ubuntu@xxxxxxx:/opt/apache-tomcat-9.0.48/conf/server.xml .

Be sure to replace ~/.ssh/amazon.pem with the actual name and location of your private key.

matigo
  • 20,403
  • 7
  • 43
  • 70