Forums

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

My VPS is not allowing port 22

kwesiaryee September 17, 2024

I am getting the following errors anytime I use the pipelines. 

 

ssh: connect to host IP port 22: Connection timed out lost connection

 

This started when the port number on my VPS was changed from 22 to 2013 due to security concerns (I was told). 

 

Please, can anyone help me out on this, please?

5 answers

1 vote
vikram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2024

Hi @kwesiaryee 

Welcome to Atlassian Community.

As per your information your port is changed to 2013 as per secuirty.

Please use 2013 port instead of 22 as below 

ssh: connect to host IP port 2013 and try. 

Let me know if it works.

Vikram P

kwesiaryee September 18, 2024

I've tried several times and the following is what i get: 

 

INFO: Starting SCP deployment to IP:2013:/home/directory/public_html/...
scp -rp -i /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp dist/spa/assets dist/spa/favicon.ico dist/spa/icons dist/spa/index.html root@IP:2013:/home/directory/public_html/
ssh: connect to host IP port 22: Connection refused
lost connection
✖ Deployment failed.
aca9d7420f98: Pull complete
0f3ac11eee9e: Pull complete
Digest: sha256:92cc16bb0a383f038bdc2443d0ea83dc390aa2f19beb0f56bf3c77ffff78ef41
Status: Downloaded newer image for bitbucketpipelines/scp-deploy:0.3.3
INFO: Starting SCP deployment to IP:2013:/home/directory/public_html/...
scp -rp -i /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp dist/spa/assets dist/spa/favicon.ico dist/spa/icons dist/spa/index.html root@IP:2013:/home/directory/public_html/
ssh: connect to host IP port 22: Connection refused
lost connection
✖ Deployment failed.

 

 

vikram
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
September 18, 2024

Hi @kwesiaryee 

Thanks for update, 

can you please try below commands to verify ssh server status:

 systemctl status ssh ---- checks the status of the SSH service on systemd-based Linux system.
service ssh status ---- checks the status of the SSH service on a system.
ss -tln --- lists all listening TCP sockets on the system including SSH server's port.
netstat -tuln --- same as above but also lists active listening TCP sockets including SSH port.
ping <hostname or IP> ---- Test basic network connectivity to a remote host.
traceroute <hostname or IP> --- Traces the route packets to reach remote host.

 

vikram P

0 votes
KaiVias
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!
December 3, 2024

I'm sorry you're having trouble with port 22 on your VPS! That can be a headache. Your hosting provider might have port 22 blocked for security reasons, or it could be a firewall setting on the server itself. I recommend checking the vps hosting provider’s documentation or support to see if they have specific instructions for allowing SSH access. Another thing you could try is connecting through a different port if your provider allows it. Sometimes, port 2222 or 2200 might work. If you’re still stuck, a quick chat with support could help clarify things.

0 votes
LyanVeness
Banned
October 22, 2024

If you're facing issues with connecting via SSH on port 22, there are a few things you can check. First, ensure that the firewall on your VPS is configured to allow traffic on the port you want to use. Since port 22 is the default for SSH, it’s often recommended to change it for security. If your provider switched it to 2013, make sure your SSH client is set to connect using that port instead. For those looking for reliable VPS hosting options, you might want to check out Zynoo, which offers affordable offshore VPS plans that can be accessed at https://zynoo.com/offshore-vps.html.

0 votes
Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 19, 2024

Hey @kwesiaryee ,

based on the error message you shared, it seems you're using the atlassian/scp-deploy pipe. Is that correct ? 

If yes, then you need to define the custom port as part of the EXTRA_ARGS variable, as in the following example:

script:
  - pipe: atlassian/scp-deploy:1.5.1
    variables:
      USER'ec2-user'
      SERVER'127.0.0.1'
      REMOTE_PATH'/var/www/build/'
      LOCAL_PATH'build/'
      DEBUG'true'
      EXTRA_ARGS: ["-P""2013"]

Thank you, @kwesiaryee !

Patrik S

kwesiaryee September 20, 2024

The following is my pipeline: 

 

master:

- step:

caches:

- node

deployment: Production

script: # Pushing to the master branch

- apt-get update

- apt-get install -y openssh-client rsync

- npm i -g @quasar/cli

- npm install

- npm run lint

- npm run format

- quasar build

artifacts:

- dist/**

- step:

name: Deploy dist folder to server via SCP

script:

- pipe: atlassian/scp-deploy:0.3.3

variables:

USER: $USER

SERVER: $SERVER

REMOTE_PATH: "/home/directory/public_html/"

LOCAL_PATH: "${BITBUCKET_CLONE_DIR}/dist/spa/*"

DEBUG: "true"

EXTRA_ARGS: ["-P", "2013"]

 

This is per your sample above, but I'm still getting an error as follows:

 

Status: Downloaded newer image for bitbucketpipelines/scp-deploy:0.3.3
DEBUG: Using default ssh key
INFO: Starting SCP deployment to IP:2013:/home/directory/public_html/...
scp -rp -i /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp /opt/atlassian/pipelines/agent/build/dist/spa/assets /opt/atlassian/pipelines/agent/build/dist/spa/favicon.ico /opt/atlassian/pipelines/agent/build/dist/spa/icons /opt/atlassian/pipelines/agent/build/dist/spa/index.html root@IP:2013:/home/directory/public_html/
ssh: connect to host IP port 22: Connection refused
lost connection
✖ Deployment failed.
aca9d7420f98: Pull complete
0f3ac11eee9e: Pull complete
Digest: sha256:92cc16bb0a383f038bdc2443d0ea83dc390aa2f19beb0f56bf3c77ffff78ef41
Status: Downloaded newer image for bitbucketpipelines/scp-deploy:0.3.3
DEBUG: Using default ssh key
INFO: Starting SCP deployment to IP:2013:/home/directory/public_html/...
scp -rp -i /opt/atlassian/pipelines/agent/ssh/id_rsa_tmp /opt/atlassian/pipelines/agent/build/dist/spa/assets /opt/atlassian/pipelines/agent/build/dist/spa/favicon.ico /opt/atlassian/pipelines/agent/build/dist/spa/icons /opt/atlassian/pipelines/agent/build/dist/spa/index.html root@IP:2013:/home/directory/public_html/
ssh: connect to host IP port 22: Connection refused
lost connection
✖ Deployment failed.

 

Kwesi

 

Patrik S
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
September 24, 2024

Hello @kwesiaryee ,

It looks like you're using a very old version of the pipe, that didn't yet support EXTRA_ARGS option, so that's the reason why it's not being taken into account.

Could you please update your command to use the latest version instead (1.5.1) ?

script:
  - pipe: atlassian/scp-deploy:1.5.1
    variables:
      USER'ec2-user'
      SERVER'127.0.0.1'
      REMOTE_PATH'/var/www/build/'
      LOCAL_PATH'build/'
      DEBUG'true'
      EXTRA_ARGS: ["-P""2013"]

Also, it's important to highlight that the port number needs only to be provided as the EXTRA_ARGS value. The SERVER variable should only contain the IP/domain of your server, not the port.

0 votes
kwesiaryee September 19, 2024

Hi Vikram, 

Thanks a lot for your response. 

 

I got the following response from my terminal:

netstat -tuln: tcp 0 0 0.0.0.0:2013 0.0.0.0:* LISTEN

service ssh status: Unit ssh.service could not be found.

service ssh status
Redirecting to /bin/systemctl status ssh.service
Unit ssh.service could not be found.

ping <hostname or IP>: -bash: port: command not found

traceroute <hostname or IP> : command not found

 

I am using almaLinux 9 as server os.

 

Kwesi

 

Suggest an answer

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

Atlassian Community Events