rfjakob / gocryptfs

Encrypted overlay filesystem written in Go
https://nuetzlich.net/gocryptfs/
MIT License
3.4k stars 244 forks source link

I can't access the contents of my encrypted files #816

Closed kulitnov852 closed 2 months ago

kulitnov852 commented 6 months ago

I encrypted a set of folders all containing files. I don't remember exactly if I checked all the encrypted files afterwards, but I deleted the non-encrypted files (the original files). Now I've noticed that the folders are there, the files are there, but when I open them they look empty.

The weirdest thing is that the size of the files seems a bit correct/accurate (because I've seen the names of my files (and again the type)). File sizes are not 0 bytes.

kulitnov852 commented 6 months ago

I've just noticed in the terminal after entering the command gocryptfs -fsck that a good number of my files are corrupt.

Ex :

... doRead 807703: corrupt block re: stupidgen: message authentication failed doRead 807703: corrupt block re: stupidgen: message authentication failed fsck: error reading file "screenshot-2022-02-01 20.05.12.312.png" (inum 807703): read /tmp/gocryptfs.fsck.793716487/screenshot-2022-02-01_20.05 12.312.png: input/output error fscheck summary: 72 corrupt, 0 files skipped

Is there any way of recovering them?

yahesh commented 4 months ago

@kulitnov852 You could try to use the -forcedecode option with a gocryptfs version older than 2.2 when mounting the folder. This might still lead to corrupted data in the files but at least you should be able to access them by ignoring the integrity check failures.

rfjakob commented 4 months ago

You can use dd_rescue to recover the non-corrupt parts of the files. I would recommend this over using -forcedecode, but both are possible.

But something like this does not happen, usually. Where do you store the encrypted files? Some cloud filesystem / sync software?