Forums

Permission denied for all files in my static folder

Hi!

I have been trying to edit some of my static files since they hold a lot of relevant data for calculations. Simple commands such as editing a file or trying to run "mv old_file_name new_file_name" are met with

"mv: cannot move 'old_file_name' to 'new_file_name': Permission denied"

Is there any fix for this?

Thanks!

What is the exact command that is running, and what working directory are you running it in?

The exact commands was "mv state-populations-clean.csv 2010_2020.csv" and I was running it in the static/data directory. However, this permissions error pops up regardless of the command I'm using. I can't even edit a jupyter notebook in there.

It sounds like the permissions for that directory might be wrong; what do you see if you run

ls -l .

...?

19:16 ~/state_pops_monthly/statepopsmonthly/static/data (updates)$ ls -l total 8900

-rwxrwxr-x 1 roko2 registered_users 4684 May 14 10:35 1990_2000.csv
-rwxrwxr-x 1 roko2 registered_users 9614 May 14 10:35 1990_2000_clean.txt
-rwxrwxr-x 1 roko2 registered_users 4688 May 14 10:35 2000_2010.csv
-rwxrwxr-x 1 roko2 registered_users 13397 May 14 10:35 all_data.csv
-rwxrwxr-x 1 roko2 registered_users 1413 May 14 10:35 data.ipynb
drwxrwxr-x 2 roko2 registered_users 4096 May 14 10:35 output
-rwxrwxr-x 1 roko2 registered_users 17359 Jul 1 23:28 result.csv
-rwxrwxr-x 1 roko2 registered_users 2927 Jul 1 23:30 result.xlsx
-rwxrwxr-x 1 roko2 registered_users 5127 May 14 10:35 state-populations-clean.csv
-rwxrwxr-x 1 roko2 registered_users 22 May 14 10:35 state_pops_monthly.zip
-rwxrwxr-x 1 roko2 registered_users 9015719 May 14 10:35 sub-est00int.csv

Could you run that again, but include the dot at the end? It should be exactly this:

ls -l .

18:23 ~/state_pops_monthly/statepopsmonthly/statepopsmonthly/static/data (updates)$ ls -l . total 8944

-rwxrwxr-x 1 roko2 registered_users 4684 May 14 10:35 1990_2000.csv
-rwxrwxr-x 1 roko2 registered_users 9614 May 14 10:35 1990_2000_clean.txt
-rwxrwxr-x 1 roko2 registered_users 4688 May 14 10:35 2000_2010.csv
-rwxrwxr-x 1 roko2 registered_users 9212 Jul 2 14:09 all_data.csv
-rwxrwxr-x 1 roko2 registered_users 1413 May 14 10:35 data.ipynb
drwxrwxr-x 2 roko2 registered_users 4096 May 14 10:35 output
-rwxrwxr-x 1 roko2 registered_users 63358 May 14 10:35 result.csv
-rwxrwxr-x 1 roko2 registered_users 4916 May 14 10:35 result.xlsx
-rwxrwxr-x 1 roko2 registered_users 5127 May 14 10:35 state-populations-clean.csv
-rwxrwxr-x 1 roko2 registered_users 22 May 14 10:35 state_pops_monthly.zip
-rwxrwxr-x 1 roko2 registered_users 9015719 May 14 10:35 sub-est00int.csv

Apologies, I missed part of the command. Could you run

ls -ld .

18:23 ~/state_pops_monthly/statepopsmonthly/statepopsmonthly/static/data (updates)$ ls -ld . dr-xr-xr-x 4 roko2 registered_users 4096 May 14 10:35 .

It looks like you're removed write permissions to the directory. Run

chmod u+w ~/state_pops_monthly/statepopsmonthly/statepopsmonthly/static/data
chmod g+w ~/state_pops_monthly/statepopsmonthly/statepopsmonthly/static/data

This unfortunately did not solve the issue.

11:28 ~/state_pops_monthly/statepopsmonthly/static/data (updates)$ chmod u+w ~/state_pops_monthly/statepopsmonthly/statepopsmonthly/static/data
11:29 ~/state_pops_monthly/statepopsmonthly/static/data (updates)$ chmod g+w ~/state_pops_monthly/statepopsmonthly/statepopsmonthly/static/data
11:30 ~/state_pops_monthly/statepopsmonthly/static/data (updates)$ mv state-populations-clean.csv 2010_2020.csv
mv: cannot move 'state-populations-clean.csv' to '2010_2020.csv': Permission denied

Then do the same chmod for each of the parent directories of static_data.

Thank you!!!!!!!!! That worked. :-)

Glad to hear that!

Actually, unfortunately that did not work either. I don't know why it seemed like it worked at the time, but the changes were not reflected in my directory and when I tried to follow the same instructions again it still gives me the

mv state-populations-clean.csv 2010_2020.csv mv: cannot move 'state-populations-clean.csv' to '2010_2020.csv': Permission denied

error.

Is the ls -ld . command from earlier still showing the directory as unwriteable?

Now the ls -ld . is showing write privileges and the file got renamed appropriately. However, this change took quite some time and all of yesterday it was giving me the permissions error. Do these write privileges need to be updated periodically? How long do these changes normally take to get implemented?

No, those permissions don't need to be updated, unless something is changing them. The changes should have effect rather immediately.