Skip to content

ssh.ParsePrivateKey: ssh: and ssh: handshake failed: ssh #371

Open
@malex30

Description

@malex30

I'm trying to test locally with 'act' and getting the issue with 'act' and on gh.

| ===========================
| 2025/03/07 17:21:23 ssh.ParsePrivateKey: ssh: no key found
| 2025/03/07 17:21:23 ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain

EC2: OpenSSH_9.6p1 Ubuntu-3ubuntu13.8, OpenSSL 3.0.13 30 Jan 2024
WSL: OpenSSH_8.9p1 Ubuntu-3ubuntu0.10, OpenSSL 3.0.2 15 Mar 2022

I have tried everything under the sun,
e.g.

  1. I have copied over using xclip(xclip -selection clipboard < ~/.ssh/mg_key.pem), echo cat,
  2. using with --------BEGIN RSA PRIVATE KEY .......-----END RSA PRIVATE KEY
  3. without
  4. base64 -w 0 ~/.ssh/mg_key.pem > ~/.ssh/mg_key.pem.b64
name: Test EC2 conn.

on:
  workflow_dispatch: # Manual trigger
  push:
    branches:
      - main
      - dev

jobs:
  test-connection:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Test EC2 Connection
        uses: appleboy/ssh-action@v1.2.1
        with:
          host: ${{ secrets.EC2_HOST }}
          username: ${{ secrets.EC2_USERNAME }}
          key: ${{ secrets.EC2_SSH_KEY }}
          timeout: 60s
          script: |
            echo "Connection successful!"
            echo "User: $(whoami)"
            echo "Current directory: $(pwd)"
            echo "Python location: $(which python || echo 'Python not found')"
            echo "System info: $(uname -a)"

            # Check for UV installation
            if command -v uv &> /dev/null; then
              echo "UV is installed: $(uv --version)"
            else
              echo "UV is not installed"
            fi

            # Check directory structure
            echo "Home directory structure:"
            ls -la ~
EC2_HOST=00.000.00.00
EC2USERNAME=ubuntu
EC2_SSH_KEY="-----BEGIN RSA PRIVATE KEY-----
..............
XUYbksBYBG1BWmAAD1fPcKFC3U+lF5TmEsKHJwIDAQABAoIBAFSCy/yGEshnKAxS
..................
-----END RSA PRIVATE KEY-----"

ps WSL -> EC2 connection works perfectly fine
ssh -i "~/.ssh/mg_key.pem" ubuntu@ec2-00-000-00-00.compute-1.amazonaws.com

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions