Permission issue with using scp-deploy to windows server

Zohar Sajith August 3, 2023

I have a windows server 2022 VM with an IIS attached to it. I am trying to follow the scp-deploy steps to put my project onto that server. I have followed the guide (found here: https://support.atlassian.com/bitbucket-cloud/docs/deploy-using-scp/) and done what was said there but I keep running into an issue where the pipeline fails at the "deploy artifacts using SCP to PROD" step. The error I get is this: 

 

Permission denied, please try again.
Permission denied, please try again.
Received disconnect from $SERVER port 22:2: Too many authentication failures

I have set up my ssh key on the Windows server and attached it to the Bitbucket repository. I tried using the ssh that Bitbucket provides as well and I still get the same error. I believe this is a Windows permission issue but I'm not too sure how to configure that.

Let me know if any additional logs are needed. Any help would be greatly appreciated!

3 answers

1 accepted

0 votes
Answer accepted
Zohar Sajith August 9, 2023

Turns out it was a permission issue. Windows has a very weird way of handling SSH requests where you have to create the file that it will accept. In your Program Data folder, under ssh, Windows will have some public/private keys that are created but in that folder, you will have to create a file called administrator_authorized_keys. Make sure that it has no file extension and add in the public key from Bitbucket or a key that you made into that file and you will be able to access your virtual machine.

It took 2 weeks for me to figure this out, hopefully this will help someone else. I ended up sticking with the SCP-Deploy pipe and was able to get it working.

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 4, 2023

Hi @Zohar Sajith 

Thank you for your question!

Since you use username and password auth you could try alternative atlassian/ftp-deploy pipe instead:

script:
  - pipe: atlassian/ftp-deploy:0.4.1
    variables:
      USER: my-ftp-user
      PASSWORD: $FTP_PASSWORD
      SERVER: 127.0.0.1
      REMOTE_PATH: /tmp/my-remote-directory


To discover more pipes, visit our Bitbucket Pipes Marketplace.

Best regards,
Oleksandr Kyrdan

Zohar Sajith August 5, 2023

Hi Oleksandr! 

Thank you for the reply! I followed the steps of setting up an FTP server on my remote windows machine and I am just about able to deploy the application. I'm having one more small issue however. For the REMOTE_PATH in the pipeline, this pipe does not accept windows paths.

The server does not have WSL installed on it nor will it be installed so I need to find a workaround for that, do you have an idea on what I could do here?

0 votes
Zohar Sajith August 3, 2023

Could there be an issue with the password? I tried doing a SCP command from my local machine into the server and I was able to send a file over, but I had to type my password in. The only thing I could see to do then is to set up passwordless ssh-ing. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events