Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied (publickey) #31

Closed
ApplecakeYT opened this issue Jan 30, 2022 · 6 comments
Closed

Permission denied (publickey) #31

ApplecakeYT opened this issue Jan 30, 2022 · 6 comments

Comments

@ApplecakeYT
Copy link

ApplecakeYT commented Jan 30, 2022

Attempting to send changes in a Github Repository to a Cloud Machine using SFTP.
I generated a keypair with ssh-keygen -t rsa -b 4096 -C "applecake" -m PEM`
I copied the public key to the server's authorized keys under /home/applecake/.ssh/authorized_keys
I then uploaded the private key as an Action Secret

Note
The key came out in this format [some parts marked redacted]
-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: [redacteddek] [redactedkey] -----END RSA PRIVATE KEY-----
but I also tried
-----BEGIN RSA PRIVATE KEY----- [redactedkey] -----END RSA PRIVATE KEY-----
Both failed.

I uploaded and committed a file to test it.
All jobs were successful except "SFTP Deploy"
These were the logs(redacted).
Run wlixcc/SFTP-Deploy-Action@v1.2.1 with: username: *** server: *** port: 22 ssh_private_key: *** local_path: .[redacted] remote_path: [redacted] args: -o ConnectTimeout=5 /usr/bin/docker run --name e21d20576865b4dd686589f1848177b27_30f637 --label 84217e --workdir /github/workspace --rm -e INPUT_USERNAME -e INPUT_SERVER -e INPUT_PORT -e INPUT_SSH_PRIVATE_KEY -e INPUT_LOCAL_PATH -e INPUT_REMOTE_PATH -e INPUT_ARGS -e HOME -e GITHUB_JOB -e GITHUB_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_REPOSITORY_OWNER -e GITHUB_RUN_ID -e GITHUB_RUN_NUMBER -e GITHUB_RETENTION_DAYS -e GITHUB_RUN_ATTEMPT -e GITHUB_ACTOR -e GITHUB_WORKFLOW -e GITHUB_HEAD_REF -e GITHUB_BASE_REF -e GITHUB_EVENT_NAME -e GITHUB_SERVER_URL -e GITHUB_API_URL -e GITHUB_GRAPHQL_URL -e GITHUB_REF_NAME -e GITHUB_REF_PROTECTED -e GITHUB_REF_TYPE -e GITHUB_WORKSPACE -e GITHUB_ACTION -e GITHUB_EVENT_PATH -e GITHUB_ACTION_REPOSITORY -e GITHUB_ACTION_REF -e GITHUB_PATH -e GITHUB_ENV -e RUNNER_OS -e RUNNER_ARCH -e RUNNER_NAME -e RUNNER_TOOL_CACHE -e RUNNER_TEMP -e RUNNER_WORKSPACE -e ACTIONS_RUNTIME_URL -e ACTIONS_RUNTIME_TOKEN -e ACTIONS_CACHE_URL -e GITHUB_ACTIONS=true -e CI=true -v "/var/run/docker.sock":"/var/run/docker.sock" -v "/home/runner/work/_temp/_github_home":"/github/home" -v "/home/runner/work/_temp/_github_workflow":"/github/workflow" -v "/home/runner/work/_temp/_runner_file_commands":"/github/file_commands" -v "/home/runner/work/RMCC/RMCC":"/github/workspace" 84217e:21d20576865b4dd686589f1848177b27 "***" "***" "22" "***" "[redacted] "[redacted]***[redacted]" "-o ConnectTimeout=5" ssh start Warning: Permanently added '***' (ECDSA) to the list of known hosts. ***@***: Permission denied (publickey).

@mrhussain0334
Copy link

ssh-keygen -m PEM -t rsa -b 4096 -C "YOUR EMAIL"

Try this when generating PEM Keys

And follow this some parts of it. I am facing the same issues hence that solved mine. Hope it solves yours.
https://zellwk.com/blog/github-actions-deploy/

@ApplecakeYT
Copy link
Author

Is it important that it has to be my email? Or can i be the username@externalserveradresss

@ApplecakeYT
Copy link
Author

Also no luck so far

@ApplecakeYT
Copy link
Author

Could it be on the server end, im running a linux instance

@mrhussain0334
Copy link

Oh sorry I didn't check my email
Is it important that it has to be my email? Or can i be the username@externalserveradresss
It can be any email

Could it be on the server end, im running a linux instance
I am also running Linux Ubuntu Server

I don't know what issue you are facing...

@ApplecakeYT
Copy link
Author

It's alright, Ive switched to an alternative. I believe it might have been an issue with how I setup users on Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants