Created
May 14, 2026 09:44
-
-
Save catbraincell/cede5c0e8e44743b465cae9a7c58858c to your computer and use it in GitHub Desktop.
Fixes Ubuntu misidentifying .pub SSH public keys as Microsoft Publisher files (application/x-mspublisher)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <!-- | |
| ============================================================================= | |
| HOW TO INSTALL (Local User Only): | |
| 1. Save this file: | |
| Command: mkdir -p ~/.local/share/mime/packages | |
| nano ~/.local/share/mime/packages/ssh-public-key.xml | |
| 2. Update the system MIME database: | |
| Command: update-mime-database ~/.local/share/mime | |
| ============================================================================= | |
| HOW TO INSTALL SYSTEM-WIDE (All Users): | |
| 1. Save this file to: /usr/share/mime/packages/ssh-public-key.xml | |
| 2. Update the global database: sudo update-mime-database /usr/share/mime | |
| --> | |
| <mime-info xmlns="freedesktop.org"> | |
| <mime-type type="application/ssh-public-key"> | |
| <comment>SSH Public Key</comment> | |
| <!-- Priority 60 forces content sniffing to override the default *.pub extension rule --> | |
| <magic priority="60"> | |
| <!-- Standard OpenSSH Key Prefixes --> | |
| <match type="string" offset="0" value="ssh-rsa"/> | |
| <match type="string" offset="0" value="ssh-ed25519"/> | |
| <match type="string" offset="0" value="ecdsa-sha2-"/> | |
| <match type="string" offset="0" value="ssh-dss"/> | |
| <!-- FIDO2 Hardware Key Prefixes --> | |
| <match type="string" offset="0" value="sk-ssh-ed25519@openssh.com"/> | |
| <match type="string" offset="0" value="sk-ecdsa-sha2-nistp256@openssh.com"/> | |
| <!-- RFC 4716 Commercial SSH Key Prefix --> | |
| <match type="string" offset="0" value="---- BEGIN SSH2 PUBLIC KEY ----"/> | |
| </magic> | |
| <glob pattern="*.pub"/> | |
| </mime-type> | |
| </mime-info> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment