We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 29181
    • 480 Posts
    Hey,
    I have a MODx plugin that creates a folder whenever a client page is setup (IE the Page created has a certain parent id).
    This all works wonderfully and I can then upload user related stuff to their directory via the resource manager.

    I can also view the folders via FTP but can’t change permissions or things like that, getting a
    550 Could not change perms on /public_html/assets/images/nameOfClient: Operation not permitted

    I don’t know who the user thinks I am when I log in via FTP, (username)?? Unfortunately I know very little about the server where MODx is hosted, or them in general when it comes to the administrative side of things.

    Does anyone have any advice how they would go about making files uploadable (via FTP) to my dynamically created folders?

    Thanks for any help!
    Taff
      Adrian Lawley: www.adrianlawley.com
      • 22303 MODX Staff
      • 10,725 Posts
      Yes, use configuration that runs PHP using suexec so that the PHP user and your account are one in the same.  Most hosts however, use mod_php and in this case, PHP executes as the webserver user account.  In these situations, you’ll have to use PHP to manipulate files/folders created with PHP, and you will not be able to manipulate it with your FTP user unless you can get access to change permissions/ownership on them (which will never be the case with shared hosting).
        • 29181
        • 480 Posts
        Firstly, thanks for your reply OpenGeek.

        As far as I know the server is a dedicated server on rackspace where my client (a web-design agency) hosts all their client sites.

        In these situations, you’ll have to use PHP to manipulate files/folders created with PHP, and you will not be able to manipulate it with your FTP user unless you can get access to change permissions/ownership on them

        So I somehow need to login as superuser, chown chgrp on folders created dynamically?

        I also delved a little deeper and with a little PHP snippet found that the script that is generating the folders is giving the "ownership" to "nobody". Would it constitute a security issue to allow all FTP accounts access to folders owned by "nobody", and is this in fact possible?

        Thanks again for your help!
        Taff
          Adrian Lawley: www.adrianlawley.com
          • 22303 MODX Staff
          • 10,725 Posts
          Quote from: Taff at Jan 12, 2009, 02:03 AM

          So I somehow need to login as superuser, chown chgrp on folders created dynamically?
          Correct, you’ll need sudo privs to chown/chgrp OR, you’ll need to add the account user to the Apache user group (nobody group in your case as you indicated), and make sure your umask is setup so that files/folders get writable permissions for the group (i.e. 775/664).

          Quote from: Taff at Jan 12, 2009, 02:03 AM
          I also delved a little deeper and with a little PHP snippet found that the script that is generating the folders is giving the "ownership" to "nobody". Would it constitute a security issue to allow all FTP accounts access to folders owned by "nobody", and is this in fact possible?
          You can as long as you trust every user and script running on that box. Otherwise, it’s better to run as suexec where there are no issues with file ownership and other people won’t have access to write to your files/folders.
            • 29181
            • 480 Posts
            Thank you very much, you’ve been a great help!
              Adrian Lawley: www.adrianlawley.com