Jump to content

[Solved] Permission denied when trying to write a file


karvp

Recommended Posts

What is trying to write to the file (PHP, node, etc.)? What are the permissions on the folder where the file will go?

Sorry about the slow response. We don't read the section you posted this in regularly. For things needing admin attention, customer service or questions will get you a faster response. Moved.

  • Like 1
Link to comment
Share on other sites

I am using Python. The folder permission is 'rwx r-x r-x' all the way down to the file from httpdocs (I changed it recursively). However, the file stayed at 'rw- r-- r--' no matter how I changed it. Also, when I try to write a non-existent file

open("nonexist.ext", "w")

It also result with an permission error.


Anyway, when I tried to write a file from php, it worked. I thought about using FTP and binding php with python but it consumes more memory and cpu, which I don't want it to.

Link to comment
Share on other sites

Try making the folders where the files will go have 757 (rwx r-x rwx) and see if the file writes successfully. If that doesn't work, try 775. I forget if it's "group" or "other" that needs it, but IIRC one of the two needs write permissions in order for Python to write files...

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...