sherlock icon indicating copy to clipboard operation
sherlock copied to clipboard

PermissionError: Permission denied when writing the file

Open valarietan opened this issue 1 year ago • 7 comments

Hi there, newbie here. Please, may I get your advice on how to resolve this?

Traceback (most recent call last): File "", line 198, in _run_module_as_main File "", line 88, in _run_code File "/Users/valarietan/sherlock/sherlock/main.py", line 22, in sherlock.main() File "/Users/valarietan/sherlock/sherlock/sherlock.py", line 697, in main with open(result_file, "w", encoding="utf-8") as file: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ PermissionError: [Errno 13] Permission denied

Saw this reported in 2020 and tried what was provided in the comments. But not successful.

Thank you.

valarietan avatar Nov 30 '23 10:11 valarietan

In Microsoft Windows, disable controlled folder access. or add Python to the list of permitted programs in Microsoft Windows for controlled folder access. I believe that is your problem. try it

@![image](https://github.com/sherlock-project/sherlock/assets/29460924/bad52d07-7430-47f1-b60e-296c9ee7eb35 Screenshot 2023-12-01 170758

Pasanlaksitha avatar Dec 01 '23 11:12 Pasanlaksitha

I have the same error, but I'm running under Windows with Vmware and Kali. Controlled folder access is off.

sugo512 avatar Dec 01 '23 23:12 sugo512

I have the same error, but I'm running under Windows with Vmware and Kali. Controlled folder access is off.

what is your prompt and used arguments to Sherlock?

and also here are a few things you can check or try to resolve this issue:

File/Directory Permissions:

Make sure that the directory where the script is trying to create the file has the appropriate write permissions for the user running the script.

Run as Administrator/Superuser:

If you're on a Unix-like system (Linux ), try running the script with elevated privileges using sudo.

Specify a Different Output Directory:

If the current directory doesn't have the necessary write permissions, you can try specifying a different directory or providing a complete path where the script has permission to write.

Pasanlaksitha avatar Dec 02 '23 11:12 Pasanlaksitha

That did it. I installed with sudo, so the Sherlock dir I was in was root root.

Thanks

sugo512 avatar Dec 02 '23 19:12 sugo512

Thank you, @Pasanlaksitha, for the helpful instructions to solve the problem.

Did the above instructions work for you as well, @valarietan?

matheusfelipeog avatar Dec 03 '23 00:12 matheusfelipeog

Hi @Pasanlaksitha

Thank you for the advice. But I'm not able to follow the instructions as I'm on Macbook Air. I used sudo to install as well. Will appreciate if you can advise how to change the permission?

Thank you.

valarietan avatar Dec 12 '23 12:12 valarietan

@valarietan, can you show the permissions you currently have in the directory and files of the cloned sherlock project?

Navigate to the base directory of sherlock and the sherlock package directory and use this command in both directories:

ls -l

matheusfelipeog avatar Dec 12 '23 21:12 matheusfelipeog