We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 24074
    • 81 Posts
    Hi, i recently bought a Debian VPS.
    I added regular user to system and installed modx in public_html of user's home directory.

    I noticed that all files and directories modx isntall created are owned by www-data user and i couldn't delete any of them.

    I tried chmoding, chowning but to no avail. When i try to delete some or all of them i get 'permission denied'.



    What is the best practice for regular users to have ability to delete/modify all these files in this nevironment without involving root access/actions?

    Thank you.
      Radio sucks!
      • 37638
      • 63 Posts
      chown -r pentago:pentago /home/pentago/public_html doesn't fix the ownership issue?
        • 28042 ☆ A M B ☆
        • 24,524 Posts
        That's the problem with a standard LAMP stack. The PHP interpreter is run as the Apache user, so your FTP user can't deal with the files that MODx creates. If you have your own server or VPS, and don't want to set up an suexec environment, you can have your Apache user belong to your FTP user's group and vice versa, then use 775 and 664 permissions for everything. Or you can get really kinky and have Apache and your FTP user be the same.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org
          • 37638
          • 63 Posts
          @sottwell Can't you also configure Apache to run PHP scripts as the user? I've heard of it but not tried.
            • 28042 ☆ A M B ☆
            • 24,524 Posts
            Yes, you can configure it to use CGI or FastCGI instead of a built-in php module. I've done it; it's much easier with the latest versions of PHP with FPM. The Apache mod_suexec module does not apply to PHP, by the way.

            http://php.net/manual/en/install.fpm.php
            http://www.howtoforge.com/using-php5-fpm-with-apache2-on-centos-6.2
              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 24074
              • 81 Posts
              Quote from: jmaddington2 at Mar 13, 2013, 11:40 AM
              chown -r pentago:pentago /home/pentago/public_html doesn't fix the ownership issue?

              I just get plenty of these:

              chown: changing ownership of `/home/pentago/public_html/html/core/packages/core': Operation not permitted



              Quote from: sottwell at Mar 13, 2013, 02:08 PM
              Yes, you can configure it to use CGI or FastCGI instead of a built-in php module. I've done it; it's much easier with the latest versions of PHP with FPM. The Apache mod_suexec module does not apply to PHP, by the way.

              I read a little bit about suexec (how it differs from suPHP?) and seems it could work.

              How is this thing sorted on various web hosts? You can delete anything modx create there but on shell server account or even VPS's regular users this doesn't work out-of-the-box. I'd like to set up my VPS so when any new users are added they do not need to bother about writing a script to delete their stuff. I'd like them to be able to manage their stuff like it supposed to be but with as secure as possible.

              Can anyone point me to right direction please?

              Thank you all!
                Radio sucks!