OPNsense Forum

English Forums => 25.7 Series => Topic started by: shadowspire on July 28, 2025, 12:12:55 AM

Title: sFTP Backups Public Key Failing
Post by: shadowspire on July 28, 2025, 12:12:55 AM
Trying to get the sFTP backups working.  From opnsense cli, I can sftp to my server using the needed private key.

From the GUI, I get this error when using the same private key:

The following input errors were detected:

    <user>@<server>: Permission denied (publickey). Connection closed

Any thoughts on what/where the issue may be?
Title: Re: sFTP Backups Public Key Failing
Post by: Stormscape on July 28, 2025, 04:59:29 AM
When you pasted the private key into the GUI window while setting it up, did you make sure there were no line breaks? Remember, you paste the key into the backups page, just having the id_rsa in ~/.ssh isn't enough.
Title: Re: sFTP Backups Public Key Failing
Post by: shadowspire on July 28, 2025, 06:25:15 PM
Yes, I made sure there are no line breaks.  Here is an example of what I pasted:

-----BEGIN OPENSSH PRIVATE KEY-----
<key data>
-----END OPENSSH PRIVATE KEY-----
Title: Re: sFTP Backups Public Key Failing
Post by: meyergru on July 28, 2025, 07:40:33 PM
Matter-of-fact, there should be line breaks. However, there are different notions of what line breaks are:

Windows: CR LF
Unix: LF
MacOS: CR

See: https://forum.opnsense.org/index.php?topic=46350
Title: Re: sFTP Backups Public Key Failing
Post by: Patrick M. Hausen on July 28, 2025, 08:32:38 PM
Quote from: meyergru on July 28, 2025, 07:40:33 PMMacOS: CR

"Mac OS 9 was a friend to us all ..."

-- Steve Jobs at the Mac OS 9 funeral


Current Mac OS uses Unix convention. Naturally ;-)
Title: Re: sFTP Backups Public Key Failing
Post by: shadowspire on July 29, 2025, 04:17:16 PM
I just noticed something very odd while digging into this.  I have be doing this all from an EndeavourOS workstation.

My private key is 27 lines long, including the "Begin" and "End" text.  When I copy the key into the OPNsense GUI, the total lines increases to 37.

I did a diff between the two and there is very little in common.  The data is getting changed somehow.

Using a Windows workstation, I was able to successfully copy the correct key into the OPNsense GUI.