cgsecurity / testdisk_documentation

Documentation for TestDisk & PhotoRec
https://www.cgsecurity.org/testdisk.pdf
43 stars 14 forks source link

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

Open lebarsfa opened 11 months ago

lebarsfa commented 11 months ago

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.

cgsecurity commented 11 months ago

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 ;-)

lebarsfa commented 11 months ago

OK, many thanks!