Missed Team ’24? Catch up on announcements here.

×
Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Bitbucket pipeline scp if setup on multiple project then second one will throw Permission denied

sahero September 13, 2019

I set up a project to SCP my build folder by using SSH keys generated by bitbucket. This is a success and working fine.

 

I set up another project to do the same in the same server but a different folder. But I got the following error:

DEBUG: Using default ssh keyINFO: Starting SCP deployment 
to xxx.xxx.xxx.x:/build/html...
scp -rp -i /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp build/asset-manifest.json build/css build/favicon.ico build/fonts build/images build/index.html build/js build/manifest.json build/precache-manifest.12de38d8917aee10a073b8a1dbac3fd1.js build/robots.txt build/scss build/service-worker.js build/static user@xxx.xxx.xxx.x:/build/html
user@xxx.xxx.xxx.x: Permission denied (publickey).
lost connection
✖ Deployment failed.

 Both projects are using bitbucket generated SSH keys. Both are different. Please help me figure out the issue.

2 answers

1 accepted

0 votes
Answer accepted
sahero December 8, 2019

I finally found the answer. SSH public key should be appended using the same user that is accessing the server from the pipelines. Before I was using root to add SSH public key.

0 votes
mkleint
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
October 8, 2019

are both public keys added to your server you are copying to? it appears like you have added just one of the public keys to your scp destination.

sahero October 9, 2019

Yes, I have added both public keys.

sahero November 7, 2019

@mkleint Can this be solved?

mkleint
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 7, 2019

sorry no idea. it feels like there is some difference in the account/repository setup that I cannot see and debug remotely.

sahero November 7, 2019

I have two different repos.  

Both projects are hosted in same server with different private keys and public keys. The first repo works perfectly, but the second one shows the above error. Is there a place if I can see the python scp-script ?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events