ssh-action icon indicating copy to clipboard operation
ssh-action copied to clipboard

port parameter always using default value

Open darioRandazzoAccedo opened this issue 8 months ago • 2 comments

Describe the bug

I am using a port forward rule on my router, so I mapped the internal port 22 to something else (let's say 1234). So, I am passing 1234 a port parameter as documented. Sadly, I got this error, which seems that it is still trying to use the default value 22 (also from the log below).

Will download drone-ssh-1.8.1-linux-amd64 from https://github.com/appleboy/drone-ssh/releases/download/v1.8.1
======= CLI Version =======
Drone SSH version 1.8.1
===========================
2025/04/18 14:45:09 dial tcp ***:22: i/o timeout
Error: Process completed with exit code 1.

If I change the rule on my router to just forward 22 to 22, the action works (despite the value passed to port is 1234).

Yaml Config

Here is my github action code:

name: Contact home

on:
  workflow_dispatch

jobs:
  build:
    runs-on: ubuntu-latest

    steps:
      - name: executing remote ssh commands using password
        uses: appleboy/ssh-action@v1
        with:
          host: ${{ secrets.TARGET_IP }}
          username: ${{ secrets.USERNAME_SSH }}
          password: ${{ secrets.PASSWORD_SSH }}
          port: ${{ secrets.TARGET_PORT_SSH }}
          script: |
            whoami
            ls -al

Related environment

Please provide the following information:

  1. Your hosting provider information, such as DigitalOcean, Linode, AWS, or GCP. I am using a ubuntu machine running in my local network.
  2. The version information of your host's SSH service. OpenSSH_9.6p1 Ubuntu-3ubuntu13.9, OpenSSL 3.0.13 30 Jan 2024
  3. The information from your host's SSH configuration file. default value

darioRandazzoAccedo avatar Apr 18 '25 14:04 darioRandazzoAccedo

edit: apologies, further testing showed this was an issue on my end and the port forwarding situation was only a coincidence

I think started getting this error today as well, but my action logs show the IPV4 address and hide the port.

I also have a home router with many port forwarding to various endpoints in the home network.

ddxv avatar May 26 '25 03:05 ddxv

Go to your repository -> Settings -> Secrets and variables -> Actions.

Edit TARGET_PORT_SSH and ensure:

It contains only 1234

add this debug lines verify your port number

  • name: Debug port run: echo "Using port: ${{ secrets.TARGET_PORT_SSH }}"

thushan-123 avatar Nov 01 '25 06:11 thushan-123