question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

SSH Key Authentication Fails with macOS Ventura

See original GitHub issue

When I try to authenticate with an RSA SSH key from Windows into macOS Ventura, I get a Permission denied (publickey). error. However, If I run the same code against macOS Monterrey, it works correctly. I’m attaching a repro solution so you can give it a try.

Repro Steps:

  • Pre-requisites:

    • Copy the content of the testKey.pub file (included in the test project) into /Users/.<userName>/ssh/authorized_keys in the Mac
  • Assign the corresponding values to the host and userName variables in the Program.cs file of the attached project

  • Build and run the console app

Expected Results: the console should connect to the host with the given username and included private key (testKey)

Current Results: the console doesn’t connect and show a Permission denied (publickey). error instead

Notes:

  • The attached SSH key pair has been generated using this command: ssh-keygen -b 2048 -t rsa -m PEM -f "<filePath/>" -q -N "<passPhrase/>"

  • If I try to SSH connect to macOS Ventura with a Windows command prompt using the same key, it works correctly

SshNetVenturaRepro.zip

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:5
  • Comments:11

github_iconTop GitHub Comments

5reactions
phu-mai-jemmiccommented, Dec 7, 2022

This solution works for me 0. (Backup ~/.ssh/ folder)

  1. If your ssh config and private/public keys are in /etc/ssh/ before upgrading the MacOS
  • copy ssh_config to ~/.ssh/config
  • copy all private/public keys to ~/.ssh/
  1. Adding the following lines at the end of ~/.ssh/config
HostkeyAlgorithms +ssh-rsa
PubkeyAcceptedAlgorithms +ssh-rsa
KexAlgorithms +diffie-hellman-group1-sha1
0reactions
Pratap22commented, Jul 7, 2023

As the solution mentioned by @phu-mai-jemmic and @giccifelipe works for rsa keys, but do you know how to fix it for ecdsa keys?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix SSH Not Working on MacOS Ventura
Try using SSH to connect to a server with RSA keys again, it should work as intended. While you're at the command line,...
Read more >
Git SSH "permission denied" in macOS 13 Ventura
When I try to authenticate with an RSA SSH key in macOS 13 (Ventura), I get a Permission denied (publickey) error.
Read more >
Passwordless SSH into MacOS Ventura 13.1
I am bit new to terminal commands so struggling a bit with passwordless SSH for rsync. I have unraid server which wants to...
Read more >
SSH Not Working In MacOS Ventura: How To Fix
Open the Finder and use the keyboard shortcut Shift+Command+G to access the "Go to Folder" dialog box. · Copy the ssh_config file and...
Read more >
Fix: SSH not working in macOS Ventura
1) Firstly, check whether the SSH server is running or not. · 2) If the SSH server is not running, then start it...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found