Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

SFTP connection doesn't open host SFTP prompt

Jonas Coenen
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 25, 2018

Having the following bitbucket-pipeline.yml:

pipelines: 
default:
-
step:
name: deploy to production
script:
-
sftp -oPort=PPPP pi@XXX.XXX.XXX.XXX
-
cd /home/username/webserver
-
put -r nameOfTheBuildFolder build/ - exit

I can see that  the sftp command is being executed, but the result is just logging:

"Connected to XXX.XXX.XXX.XXX"

But it's not opening a sftp prompt.

Is there a way to actually browse and do command on the sftp prompt? Or is there a command to connect to the sftp prompt?

I also made a ticket at stackoverflow: https://stackoverflow.com/questions/50529815/bitbucket-pipeline-sftp-connection-doesnt-open-host-sftp-prompt

2 answers

1 vote
jredmond
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
May 25, 2018

Pipelines are meant to be non-interactive, so it won't give you a prompt. You'll need either to use SSH keys for authentication, or provide the relevant password as an environment variable.

0 votes
Mehdi Mohamed
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 5, 2018

@Jonas Coenen trust me I am in the same situation, I have tried way too many FTP solutions but with Bit bucket it seems mystery. I have received a solution just now from Atlassian team which is as follows, please try it and let me know if it worked. Although the support is quick, but the level of support/response is not satisfactory for me to recommend bitbucket pipelines to other customers.

Solution to set up hosts within Bitbucket:

https://community.atlassian.com/t5/Bitbucket-questions/How-do-I-set-up-ssh-public-key-authentication-so-that-I-can-use/qaq-p/171671

For transferring the files using PSFTP, you will need to add the following commands before the call:

cd /home/ftp/users/jeff
del jam-old.tar.gz
ren jam.tar.gz jam-old.tar.gz
put jam.tar.gz
chmod a+r jam.tar.gz 

and then run the script.
Please refer to this document for more details: 
https://the.earth.li/~sgtatham/putty/0.60/htmldoc/Chapter6.html

There are also more solutions offered in the following post:
https://stackoverflow.com/questions/7576700/how-to-pass-value-to-psftp-prompt

Please take a look, make necessary adjustments to the YML file and create the recommended file with batch commands and give it a go. 

I am using Solarwinds SFTP server and bit bucket pipelines, I'll try my luck. Let me know if the solution mentioned works for you.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events