Jump to content

[Solved] Permission denied when trying to write a file


Recommended Posts

Posted

Hello, so I got this error when trying to write a file:
 

PermissionError: [Errno 13]

Does Heliohost's Johnny server allow us to write? And if not, are there alternative ways?

Posted

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
Posted

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.

Posted

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...

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...