Help runners+sftp Connection refused
Asked by ?????:

Hi! I have a problem, I can't understand why there is no connection. Please have any ideas? from other sources, I connect to my host without any problems. and this problem is also with rsync deploy

Help me please![bitbucket-pipeline.jpg](/t5/image/serverpage/image-id/240904iAC066F9DABD4E0C2/image-size/large?v=v2&px=999 "bitbucket-pipeline.jpg")![buil.jpg](/t5/image/serverpage/image-id/240905i7568305D9599E5D3/image-size/large?v=v2&px=999 "buil.jpg")


Answers:
author: Oleksandr Kyrdan
body: Hi   
For this case you need to pass SSH_KEY directly to the pipe

|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| SSH_KEY | An alternate SSH_KEY to use instead of the key configured in the Bitbucket Pipelines admin screens (which is used by default). This should be encoded as per the instructions given in the docs for [using multiple ssh keys](https://confluence.atlassian.com/bitbucket/use-ssh-keys-in-bitbucket-pipelines-847452940.html#UseSSHkeysinBitbucketPipelines-multiple_keys) |

```
script:  - pipe: atlassian/sftp-deploy:0.5.11    variables:      USER: 'ec2-user'      SERVER: '127.0.0.1'      REMOTE_PATH: '/var/www/build/'      LOCAL_PATH: 'build'      SSH_KEY: $MY_SSH_KEY      DEBUG: 'true'
```

```
script:  - pipe: atlassian/rsync-deploy:0.8.1    variables:      USER: 'ec2-user'      SERVER: '127.0.0.1'      REMOTE_PATH: '/var/www/build/'      LOCAL_PATH: 'build'      SSH_KEY: $MY_SSH_KEY      DEBUG: 'true'
```

Best regards,  
Oleksandr Kyrdan

comments: author: ?????
body: thank you for being with me, I added my keys, but still a mistake![12.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/241153i01F588DF4EF290B1/image-size/large?v=v2&px=999 "12.jpg")


author: ?????
body: Hi! my problem is relevant. I'm not getting anywhere. I did curl, in all cases it was refused. Maybe you have blocked IP addresses and therefore my connections are being reset.![photo1677484072 (2).jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/242481i6128D681F035AAA1/image-size/large?v=v2&px=999 "photo1677484072 (2).jpeg")![photo1677484072 (1).jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/242482i6443E7A3F90EF4EC/image-size/large?v=v2&px=999 "photo1677484072 (1).jpeg")![photo1677484072.jpeg](https://community.atlassian.com/t5/image/serverpage/image-id/242483i9BE20007BA0635E1/image-size/large?v=v2&px=999 "photo1677484072.jpeg")


author: ?????
body: I don't understand what I'm doing wrong. Please help me![rsync1.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/241175iB548070F99693613/image-size/large?v=v2&px=999 "rsync1.jpg")![rsync12.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/241174i8D60B109D97EAED5/image-size/large?v=v2&px=999 "rsync12.jpg")

comments: author: Oleksandr Kyrdan
body: Make sure you encode your SSH_KEY accordingly:

### Linux {#toc-hId-2004304797}

```
`base64 -w 0 < my_ssh_key`
```

### Mac OS X {#toc-hId-196850334}

```
`base64 < my_ssh_key`
```

`and copy/paste the value without trailing symbols.`

To validate base64 encoded SSH_KEY, try to decode it and use for the direct connection on your local machine.


author: ?????
body: Thank you for helping me. I added the key and tested it, if the key is incorrect, the log informs me, but with the correct connection it is refused. The local host connects without problems![correct.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/241495iD02B003925444DE4/image-size/large?v=v2&px=999 "correct.jpg")![incorrect.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/241496i6B388717FA53794B/image-size/large?v=v2&px=999 "incorrect.jpg")![local.jpg](https://community.atlassian.com/t5/image/serverpage/image-id/241494i539BB0903029F8A6/image-size/large?v=v2&px=999 "local.jpg")


Tags: bitbucket-cloud

cloud