Windows – Why are files created by Puttygen hidden in Windows 7 Explorer

ntfsputtywindows-explorer

In Windows 7 Home Premium, after saving a private key in PuTTY Key Generator (aka. Puttygen) at the C drive root it is not visible in Explorer.

How to reproduce:

  1. Start Puttygen.
  2. Generate a key.
  3. Click "Save private key" (this also works for "Save public key", but I only tested the original case with that).
  4. Navigate to C:.
  5. Enter a name, for example id_rsa, to save the file as C:\id_rsa.ppk.
  6. Start Explorer.
  7. Navigate to C:.

Result: No id_rsa.ppk is visible.

To prove that the file exists:

  1. Go back to Puttygen.
  2. Click the "Save private key" button again.
  3. Navigate to C:.

In this window, you can interact with the file. I checked the file properties from there:

  • It's not hidden.
  • "Full control" is checked for my user.
  • "Opens with" strangely says "Windows Shell Common Dll".

Additional information:

  • I installed Windows yesterday, so it's not some Sony-infested monstrosity.
  • It's got all the latest security updates and .NET 4.0.
  • I do have TortoiseGit and 7zip integration installed, so it is conceivable that they have something to do with this (although .ppk files should not be related to either of them).

Things which did make the file show up in Explorer:

  • Saved the file in another directory, then copied/moved it (both worked) with Explorer to C:\. I did get a "Destination Folder Access Denied" request where I had to click "Continue" first.
  • Saved the file in another directory and navigated there instead.
  • Saved the file on the root of another disk (D: in this case) and navigated there.

Things which failed to make the file show up in Explorer (hitting F5 to refresh in the Explorer window after each action):

  • Renamed the file to foo.ppk.
  • Saved a second copy under a different name.
  • Turned on "Show hidden files, folders and drives".
  • Turned off "Hide protected operating system files".
  • Saved the file in another directory, then copied it to C:\ in the Puttygen save dialog. I was not asked to give permission to save the file, like in Explorer.

My naive assumption is that Explorer has some built-in special case for "restricted" (not actually restricted, since Puttygen trivially ignores it) directories, only updating the file list through the "Destination Folder Access Denied" dialog. What is the actual cause?

Best Answer

In Vista and newer versions of Windows, an unprivileged process is not allowed to save to folders where "Users" doesn't have write access (even if you are a local admin and the Administrators group does have access). So when an unprivileged program tries to write a file there it actually gets saved in %localappdata%\VirtualStore.

Related Question