SFTP connection timeout issue
Asked by Rahul Johny:

I have configured the pipeline as below.

- pipe: atlassian/sftp-deploy:0.5.7  
variables:  
USER: 'oracle'  
SERVER: '120.139.9.213'  
REMOTE_PATH: "/home/oracle/testDeploy"  
LOCAL_PATH: '$BITBUCKET_CLONE_DIR/release_package/\*'  
PASSWORD: 'xxxxxx'  
DEBUG: 'true'  
EXTRA_ARGS: '-P 2232'  
#EXTRA_ARGS: \["-P", "2232"\]  

I am able to SFTP using winscp to the host with password

Please find the logs below.

--env=BITBUCKET_REPO_OWNER="$BITBUCKET_REPO_OWNER" \ --env=BITBUCKET_REPO_IS_PRIVATE="$BITBUCKET_REPO_IS_PRIVATE" \ --env=BITBUCKET_WORKSPACE="$BITBUCKET_WORKSPACE" \ --env=BITBUCKET_REPO_OWNER_UUID="$BITBUCKET_REPO_OWNER_UUID" \ --env=BITBUCKET_STEP_RUN_NUMBER="$BITBUCKET_STEP_RUN_NUMBER" \ --env=BITBUCKET_BUILD_NUMBER="$BITBUCKET_BUILD_NUMBER" \ --env=BITBUCKET_BRANCH="$BITBUCKET_BRANCH" \ --env=BITBUCKET_GIT_SSH_ORIGIN="$BITBUCKET_GIT_SSH_ORIGIN" \ --env=BITBUCKET_PIPELINE_UUID="$BITBUCKET_PIPELINE_UUID" \ --env=BITBUCKET_COMMIT="$BITBUCKET_COMMIT" \ --env=BITBUCKET_REPO_UUID="$BITBUCKET_REPO_UUID" \ --env=BITBUCKET_CLONE_DIR="$BITBUCKET_CLONE_DIR" \ --env=BITBUCKET_PROJECT_KEY="$BITBUCKET_PROJECT_KEY" \ --env=PIPELINES_JWT_TOKEN="$PIPELINES_JWT_TOKEN" \ --env=BITBUCKET_STEP_UUID="$BITBUCKET_STEP_UUID" \ --env=BITBUCKET_DOCKER_HOST_INTERNAL="$BITBUCKET_DOCKER_HOST_INTERNAL" \ --env=DOCKER_HOST="tcp://host.docker.internal:2375" \ --env=BITBUCKET_PIPE_SHARED_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes" \ --env=BITBUCKET_PIPE_STORAGE_DIR="/opt/atlassian/pipelines/agent/build/.bitbucket/pipelines/generated/pipeline/pipes/atlassian/sftp-deploy" \ --env=DEBUG="true" \ --env=EXTRA_ARGS="-P 2232" \ --env=LOCAL_PATH="$BITBUCKET_CLONE_DIR/release_package/*" \ --env=PASSWORD="" \ --env=REMOTE_PATH="/home/oracle/testDeploy" \ --env=SERVER="120.139.9.213" \ --env=USER="oracle" \ --add-host="host.docker.internal:$BITBUCKET_DOCKER_HOST_INTERNAL" \ bitbucketpipelines/sftp-deploy:0.5.7Unable to find image 'bitbucketpipelines/sftp-deploy:0.5.7' locally0.5.7: Pulling from bitbucketpipelines/sftp-deploy31603596830f: Pulling fs layer5223754e1462: Pulling fs layere082d8591f92: Pulling fs layer11c53ae80555: Pulling fs layer3dc58ede5d22: Pulling fs layer3dc58ede5d22: Waiting11c53ae80555: Waitinge082d8591f92: Verifying Checksume082d8591f92: Download complete31603596830f: Verifying Checksum31603596830f: Download complete5223754e1462: Verifying Checksum5223754e1462: Download complete11c53ae80555: Verifying Checksum11c53ae80555: Download complete31603596830f: Pull complete3dc58ede5d22: Verifying Checksum3dc58ede5d22: Download complete5223754e1462: Pull completee082d8591f92: Pull complete11c53ae80555: Pull complete3dc58ede5d22: Pull completeDigest: sha256:4767af0e7706ae28565f2903e28a7747e098284eb0b6324430ada075469c4023Status: Downloaded newer image for bitbucketpipelines/sftp-deploy:0.5.7+ SFTP_DEBUG_ARGS=-v+ [[ -z ]]+ info 'Using PASSWORD.'INFO: Enabling debug mode.INFO: Using PASSWORD.+ echo -e '\e[36mINFO: Using PASSWORD.\e[0m'+ setup_ssh_dir+ INJECTED_SSH_CONFIG_DIR=/opt/atlassian/pipelines/agent/ssh+ IDENTITY_FILE=/opt/atlassian/pipelines/agent/ssh/id_rsa_tmp+ KNOWN_HOSTS_FILE=/opt/atlassian/pipelines/agent/ssh/known_hosts+ mkdir -p /root/.ssh+ touch /root/.ssh/authorized_keys+ [[ -z ]]+ '[' '!' -f /opt/atlassian/pipelines/agent/ssh/known_hosts ']'+ cat /opt/atlassian/pipelines/agent/ssh/known_hosts+ '[' -f /root/.ssh/config ']'+ [[ -z ]]+ chmod -R go-rwx /root/.ssh/+ run_pipe+ info 'Starting SFTP deployment to 120.139.9.213:/home/oracle/testDeploy...'+ echo -e '\e[36mINFO: Starting SFTP deployment to 120.139.9.213:/home/oracle/testDeploy...\e[0m'+ set +e+ [[ -z 3 ]]INFO: Starting SFTP deployment to 120.139.9.213:/home/oracle/testDeploy...+ debug Executing echo '"mput' '/opt/atlassian/pipelines/agent/build/release_package/*"' '|' sshpass -p ######@123 sftp -o PubkeyAuthentication=no -rp -v -P 2232 [oracle@120.139.9.213](mailto:oracle@120.139.9.213):/home/oracle/testDeploy+ [[ true == \t\r\u\e ]]+ echo -e '\e[37mDEBUG: Executing echo "mput /opt/atlassian/pipelines/agent/build/release_package/*" | sshpass -p sftp -o PubkeyAuthentication=no -rp -v -P 2232 [oracle@120.139.9.213](mailto:oracle@120.139.9.213):/home/oracle/testDeploy\e[0m'DEBUG: Executing echo "mput /opt/atlassian/pipelines/agent/build/release_package/*" | sshpass -p #######@123 sftp -o PubkeyAuthentication=no -rp -v -P 2232 [oracle@120.139.9.213](mailto:oracle@120.139.9.213):/home/oracle/testDeploy+ echo 'mput /opt/atlassian/pipelines/agent/build/release_package/*'+ sshpass -p sftp -o PubkeyAuthentication=no -rp -v -P 2232 [oracle@120.139.9.213](mailto:oracle@120.139.9.213):/home/oracle/testDeployOpenSSH_7.9p1, OpenSSL 1.1.1g 21 Apr 2020debug1: Reading configuration data /etc/ssh/ssh_configdebug1: Connecting to 120.139.9.213 [120.139.9.213] port 2232.debug1: connect to address 120.139.9.213 port 2232: Operation timed outssh: connect to host 120.139.9.213 port 2232: Operation timed outConnection closed+ STATUS=255+ set -e

![Capture.PNG](https://community.atlassian.com/t5/image/serverpage/image-id/129276i1102BDF5315AB569/image-size/large?v=v2&px=999 "Capture.PNG")


Answers:
author: Oleksandr Kyrdan
body: Hi [@Rahul Johny](/t5/user/viewprofilepage/user-id/4247208) ,

Thank you for your question!

**IMPORTANT!**   
**Please, try to avoid post debugged output with your sensitive data.**   
**We're highly recommend to change your service password as soon as possible.**

<br />

Is provided port 2232 accessible?

comments: author: Rahul Johny
body: yes its accessible. when connecting via WinSCP


author: Rahul Johny
body: [@Oleksandr Kyrdan](/t5/user/viewprofilepage/user-id/2885705) yes the port is accessible


author: ktomk
body: Connection timed out. Perhaps the remote system is not reachable? For example behind a Firewall?

[What are the IP addresses to configure a corporate firewall?](https://support.atlassian.com/bitbucket-cloud/docs/what-are-the-bitbucket-cloud-ip-addresses-i-should-use-to-configure-my-corporate-firewall/)


Tags: bitbucket-pipelines

cloud

sftp