简体   繁体   中英

Upload crt to ec2 running Amazon Linux

I have an ec2 running Amazon Linux. I have a crt and need to upload it to /etc/pki/tls/certs.

SFTP says permission denied, and I can't change the permissions.

I have an SSH connection, but I don't know how to upload a file via the terminal.

I looks at recommendations involving scp and tried...

scp custom.crt ec2-user@ip-172-31-1-182:/etc/pki/tls/certs

I got...

The authenticity of host 'ip-172-31-1-182 (172.31.1.182)' can't be established.
ECDSA key fingerprint is xxxxxxxxx
ECDSA key fingerprint is xxxxxxxxx
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'ip-172-31-1-182,172.31.1.182' (ECDSA) to the list of known hosts.
Permission denied (publickey).
lost connection

Is there something wrong in my scp command?

Is there an alternative?

by default ec2-user doesn't have permission to write any file in /etc/pki/tls/certs location. you can simply scp the cert to home of ec2-user or in /tmp directory. after that ssh to the server and use sudo to copy/move the file in /etc/pki/tls/certs location. Below is command for the same:

scp custom.crt ec2-user@ip-172-31-1-182:/home/ec2-user
ssh ec2-user@ip-172-31-1-182
sudo mv custom.crt /etc/pki/tls/certs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM