diff --git a/filemanager/filemanager.py b/filemanager/filemanager.py index ab7541a9f..b051c9e6d 100644 --- a/filemanager/filemanager.py +++ b/filemanager/filemanager.py @@ -1039,8 +1039,9 @@ class FileManager: 'error_message': "Symlink attack."}) return HttpResponse(final_json) + # Set home directory ownership command = 'chown %s:%s /home/%s' % (website.externalApp, website.externalApp, domainName) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) ### Sym link checks @@ -1053,21 +1054,21 @@ class FileManager: 'error_message': "Symlink attack."}) return HttpResponse(final_json) - command = 'chown -R -P %s:%s /home/%s/public_html/*' % (externalApp, externalApp, domainName) - ProcessUtilities.popenExecutioner(command) - - command = 'chown -R -P %s:%s /home/%s/public_html/.[^.]*' % (externalApp, externalApp, domainName) - ProcessUtilities.popenExecutioner(command) - - # command = "chown root:%s /home/" % (groupName) + domainName + "/logs" - # ProcessUtilities.popenExecutioner(command) - + # Set file permissions first (before ownership to avoid conflicts) command = "find %s -type d -exec chmod 0755 {} \;" % ("/home/" + domainName + "/public_html") - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) command = "find %s -type f -exec chmod 0644 {} \;" % ("/home/" + domainName + "/public_html") - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) + # Set ownership for all files inside public_html to user:user + command = 'chown -R -P %s:%s /home/%s/public_html/*' % (externalApp, externalApp, domainName) + ProcessUtilities.executioner(command) + + command = 'chown -R -P %s:%s /home/%s/public_html/.[^.]*' % (externalApp, externalApp, domainName) + ProcessUtilities.executioner(command) + + # Set public_html directory itself to user:nogroup with 750 permissions command = 'chown %s:%s /home/%s/public_html' % (externalApp, groupName, domainName) ProcessUtilities.executioner(command) @@ -1084,21 +1085,23 @@ class FileManager: 'error_message': "Symlink attack."}) return HttpResponse(final_json) - + # Set file permissions first command = "find %s -type d -exec chmod 0755 {} \;" % (childs.path) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) command = "find %s -type f -exec chmod 0644 {} \;" % (childs.path) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) + # Set ownership for all files inside child domain to user:user command = 'chown -R -P %s:%s %s/*' % (externalApp, externalApp, childs.path) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) command = 'chown -R -P %s:%s %s/.[^.]*' % (externalApp, externalApp, childs.path) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) + # Set child domain directory itself to 755 with user:nogroup command = 'chmod 755 %s' % (childs.path) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command) command = 'chown %s:%s %s' % (externalApp, groupName, childs.path) - ProcessUtilities.popenExecutioner(command) + ProcessUtilities.executioner(command)