• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • We are looking for U.S.-based freelancer or agency working with SEO or WordPress for a quick 30-min interviews to gather feedback on XOVI, a successful German SEO tool we’re looking to launch in the U.S.
    If you qualify and participate, you’ll receive a $30 Amazon gift card as a thank-you. Please apply here. Thanks for helping shape a better SEO product for agencies!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

Python Permissions to Write Files in another web space on same server

Quotes

New Pleskian
I have a python script that generates images and is able to write them into a directory on the same web space

However, I would like the same script to write files into another directory located in the web space of another domain on the same server.

For example, script lives here...
/var/www/vhosts/domain1.com/httpdocs/scripts/myscript.py

this works...
/var/www/vhosts/domain1.com/httpdocs/scripts/images/

this fails...
/var/www/vhosts/domain2.com/httpdocs/web/images/

The directory structure already exists, so there is no need to create any new directories

I have tried setting permissions for the destination "images" directory to 777 and that didn't work.

Do I need to specify something within Plesk to enable it to write to another directory?
 
It failes because you don't have permission there, thus you will need to configure open_basedir in order for this to work.

In Control panel of domain, click on the domain name -> PHP Settings -> set open_basedir (path to this domain2.com images folder)

It should work.
 
Thank you MislavO

I updated the open_basedir settings (in domain1) to point to the destination directory (domain2) but it didn't work

I have another domain with custom open_basedir settings so I'm sure the syntax of the new setting was correct

I have checked my log files but can't see any reference to the error writing the files
 
Script should write something in the error.log file in case of a permission/open_basedir problem. If error log is empty then you need to check your application, debug it more futher.

Stupid question but, do you have under hosting settings under domain2 Python support enabled?

Are you running that script as a cronjob or ? Temporary workaround would be, if both of domain are yours to run that script as root user.
 
Python wasn't enabled on domain2... I updated and ran the python script on domain1 again and still no luck (even with open_basedir specified).

I've double checked the error logs, still nothing, so I will have to go back to the script author and see if there is a debug mode

I'm pretty sure you are on the right track and it is a permissions thing - the script works fine when running on domain1 and writing to domain1.
 
No solution found yet, but have obtained a verbose error message

IOError: [Errno 13] Permission denied:

Script is running via Cron, on Plesk Linux v11.5.30 and python v2.6
 
Back
Top