0

I copied an SSH private key from my Linux machine to my M1 Mac. (I've attempted to do this both by uploading the cyphertext to a secrets manager as well as directly transfering the file) but when attempting to SSH to the same machine from each I can only succeed from the Linux machine.

Linux machine:

$ ssh -V
OpenSSH_8.2p1 Ubuntu-4ubuntu0.4, OpenSSL 1.1.1f  31 Mar 2020
$ md5sum id_rsa
7ed8b0c73e168ef48acc715d4c6bcf73  id_rsa
$ sha256sum id_rsa
969d0a35b36c50035881bdd2d8367b90dbff548131d5c72989d29e83b7a3aa19  id_rsa
$ ssh-keygen -l -f id_rsa
4096 SHA256:d19Ee+tlzVHitLzKuuZbdgYcnhla96ypXNtpBwrqfqE [email protected] (RSA)
$ ssh -i id_rsa [email protected]
[redacted MOTD; WORKS]

M1 Mac:

$ ssh -V
openSSH_8.6p1, LibreSSL 2.8.3
$ md5 id_rsa
MD5 (id_rsa) = 7ed8b0c73e168ef48acc715d4c6bcf73
$ shasum -a 256 id_rsa
969d0a35b36c50035881bdd2d8367b90dbff548131d5c72989d29e83b7a3aa19  id_rsa
$ ssh-keygen -l -f id_rsa
4096 SHA256:rWsP9jN2otlchh8icr/jlnZxDjEfEkngDJOoPh4RYZI [email protected] (RSA)
$ ssh -i id_rsa [email protected]
[email protected]: Permission denied (publickey).

AFAICT these private keys are identical. However for some reason ssh-keygen does not fingerprint them thesame. Even though they have identical checksums. Could this be an issue with the M1 SoC? Or is there something much more obvious happening here?

8
  • The output of ssh-keygen differs, is this as expected?
    – nohillside
    Commented Feb 7, 2022 at 18:18
  • Is your public key in authorized_keys on the target? Commented Feb 7, 2022 at 18:34
  • 2
    You're passing the -l option to ssh-keygen with your private key, but the man page says that option is for fingerprinting public keys: "Show fingerprint of specified public key file. For RSA and DSA keys ssh-keygen tries to find the matching public key file and prints its fingerprint."
    – Cody
    Commented Feb 7, 2022 at 20:50
  • 1
    But does the new machine have a copy of the public key? Commented Feb 8, 2022 at 14:36
  • 1
    @Cody your comment is the answer. ssh-keygen is reporting the fingerprint of the public key and not the private (even if I am giving it the path to the private) and there was a typo in there.
    – CRThaze
    Commented Feb 9, 2022 at 17:04

2 Answers 2

3

No, it is not an issue with the M1 SoC. There's absolutely nothing in your question that in any way suggest or hints at this being an issue with the M1 SoC. Instead try to solve this problem like you would solve it on any other CPU.

For example you can use the "-v" parameter for ssh to gain further insight into what happens. You'll probably find that there's a perfectly logical explanation to this - for example that you're using an unsupported key type, that your configuration is setup with incompatible ciphertypes, etc.

2

The issue here as pointed out by @Cody was a misunderstanding with how ssh-keygen reports on figerprints. Even if you provide it with the path to a private key, with the -l flag it will use the corresponding public key file. And that's where I still had a mismatch. Upon fixing the public key everything worked as expected.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .