testdisk_documentation icon indicating copy to clipboard operation
testdisk_documentation copied to clipboard

Creating custom signature for PhotoRec: `.photorec.sig`/`photorec.sig` actual search location might not be what we think...

Open lebarsfa opened this issue 2 years ago • 2 comments

The documentation on https://www.cgsecurity.org/testdisk_doc/photorec_custom_signature.html#file-location suggests that .photorec.sig can be put in the HOME directory. However, on Ubuntu 22.04 I get:

user@Ubuntu64:~/Downloads/testdisk-7.2-WIP.linux26-x86_64/testdisk-7.2-WIP$ cat ~/.photorec.sig 
zstd 0 0x28, 0xB5, 0x2F, 0xFD
user@Ubuntu64:~/Downloads/testdisk-7.2-WIP.linux26-x86_64/testdisk-7.2-WIP$ sudo ./fidentify_static ~/Downloads/f802010968.zstd 
/home/user/Downloads/f802010968.zstd: unknown
user@Ubuntu64:~/Downloads/testdisk-7.2-WIP.linux26-x86_64/testdisk-7.2-WIP$ sudo -E ./fidentify_static ~/Downloads/f802010968.zstd 
/home/user/Downloads/f802010968.zstd: zstd
user@Ubuntu64:~/Downloads/testdisk-7.2-WIP.linux26-x86_64/testdisk-7.2-WIP$ ./fidentify_static ~/Downloads/f802010968.zstd 
/home/user/Downloads/f802010968.zstd: zstd

Is it possible to emphasize in the documentation that running with sudo (or possibly using right-click and Run as administrator on Windows or other methods that could explicitly or silently make the program run as another user/administrator) may change what is considered as HOME/USERPROFILE directory? Also, the actual current directory may vary depending on several factors (it could be the program location, the current directory if run from the terminal, it could be dynamically changed by the program or OS, etc.).

This is because I think I ran into this trap and I suspect e.g. https://forum.cgsecurity.org/phpBB3/viewtopic.php?p=37647#p37647 had the same problem.

lebarsfa avatar Oct 21 '23 20:10 lebarsfa

I have added a warning in https://www.cgsecurity.org/testdisk_doc/photorec_custom_signature.html#run-photorec Please tell me if it's OK as it is or feel free to provide an alternative text ;-)

cgsecurity avatar Oct 22 '23 08:10 cgsecurity

OK, many thanks!

lebarsfa avatar Oct 22 '23 11:10 lebarsfa