0

When I open .ppk or .pub files (in my ~/.ssh directory), I'm unable to view the data. All I see are boxes as shown below. How do I fix this?

enter image description here

vidarlo
  • 22,691
Brad West
  • 111
  • Hi, please check this thread out https://askubuntu.com/questions/818929/login-ssh-with-ppk-file-on-ubuntu-terminal. – lordparthurnaax Jan 23 '19 at 18:56
  • I don't want to convert the file. I want to see its contents. – Brad West Jan 23 '19 at 18:58
  • I'm pretty sure gedit is missing the requisite plugins. The converted format mentioned might be linux-readable, hence my comment. You can try try more <filename.ppk> on terminal once, maybe that will help. Cheerios :) – lordparthurnaax Jan 23 '19 at 19:01
  • Yes, more <filename.ppk> does show the contents of the file in the terminal. Any idea what plugin would allow me to view this in gedit? – Brad West Jan 23 '19 at 19:03
  • Could it be a wrong encoding guessed by Gedit? What does file <filename.ppk> say? – Melebius Jan 24 '19 at 14:44

1 Answers1

2

EDIT: Please note there are actually two versions of PPK files at play - one is the "older" binary one, and one is the newer "readable" one.

PPK files are Putty Private Key files, readable by PuttyGEN and Putty. In older PPK generated versions, they are stored as binary files, meaning they do not have any human-readable bits in them.

If you intend to read the contents of an old-style PPK, such as the specific private key bits that you'd find with an ssh-keygen'd private key, you need to convert the PPK to OpenSSH format and then read the Base64'd ASCII.

This applies for the Public Key file as well, though it's in SSH2 format which is not the format that'll work for SSH.


In newer versions of PuttyGEN and Putty(and not in the repos for Linux at this time), the PPK file is human readable to an extent. This means that in the latest PuTTY, you can read the PPK and Public Key as human readable.

However I have not found this 'newer' PuTTY on Linux yet, and only have found those binaries on Linux.

Also, without actually examining the files themselves, I can't determine whether the file you think is a PPK or a public key is actually a key that you can easily properly read or not; some keys are in 'binary form' and not openable, and those're either old PPK files or not the files you think they are and therefore aren't human readable (identification certificates for example can be used with OpenSSH connections, and if the certificate is in DER format it's in binary non-human-readable format).

Thomas Ward
  • 74,764
  • I have two Ubuntu 18.04 machines. On one of them I can open the file with gedit, on the other I can not. No converting necessary. – Brad West Jan 23 '19 at 19:02
  • please edit the question and add in 2 images with the exact same file opened on those 2 machines if that is true. Not just the wrongly shown file ;) – Rinzwind Jan 23 '19 at 19:04
  • Isn't that exactly what this thread (https://askubuntu.com/questions/818929/login-ssh-with-ppk-file-on-ubuntu-terminal) is about? – lordparthurnaax Jan 23 '19 at 19:08
  • If it is, I'm not smart enough to understand it. I see nothing in there about gedit. – Brad West Jan 23 '19 at 19:11
  • 1
    @BradWest there's nothing in that thread about gedit. And I can confirm that on six 18.04 machines it is not readable. The one that is readable is not actually a Putty Private Key. PPK files are Putty's binary format. You might be reading a standard private key file but not the PPK, which would be human readable Base64-encoded/encrypted text) – Thomas Ward Jan 23 '19 at 19:18
  • I can confirm that it is viewable on 18.04: https://www.youtube.com/watch?v=tDynXWgmkvs – Brad West Jan 24 '19 at 03:09
  • @BradWest Where did you generate the PPK? Windows? puttygen on Linux? That PPK actually looks more like an SSH2 formatted Private Key, and not an actual PuttyGEN PPK file. – Thomas Ward Jan 24 '19 at 14:31
  • I feel confident this has nothing to do with the files themselves—it is a problem with gedit. I can open the files on one system and not on the other. That said, I most likely generated this on a Windows system. – Brad West Jan 24 '19 at 15:09
  • I just tried opening them again and they are viewable in gedit on the new system. No idea what changed from yesterday to today. I made no changes to gedit preferences and didn't install any new software. ¯_(ツ)_/¯ I appreciate all the help, nonetheless. – Brad West Jan 24 '19 at 15:17