diff --git a/filemanager/filemanager.py b/filemanager/filemanager.py index fd4d2fbb8..a43f2e4bd 100755 --- a/filemanager/filemanager.py +++ b/filemanager/filemanager.py @@ -5,7 +5,6 @@ from plogical.processUtilities import ProcessUtilities from websiteFunctions.models import Websites from random import randint from django.core.files.storage import FileSystemStorage -import html.parser from plogical.acl import ACLManager class FileManager: @@ -522,4 +521,17 @@ class FileManager: ProcessUtilities.executioner(command) command = 'chmod 750 /home/%s/public_html' % (domainName) - ProcessUtilities.executioner(command) \ No newline at end of file + ProcessUtilities.executioner(command) + + for childs in website.childdomains_set.all(): + command = 'chown -R %s:%s %s/*' % (externalApp, externalApp, childs.path) + ProcessUtilities.popenExecutioner(command) + + command = 'chown -R %s:%s %s/.[^.]*' % (externalApp, externalApp, childs.path) + ProcessUtilities.popenExecutioner(command) + + command = 'chmod 750 %s' % (childs.path) + ProcessUtilities.popenExecutioner(command) + + command = 'chmod %s:%s %s' % (externalApp, groupName, childs.path) + ProcessUtilities.popenExecutioner(command) \ No newline at end of file diff --git a/plogical/backupUtilities.py b/plogical/backupUtilities.py index b1dc175c1..413110892 100755 --- a/plogical/backupUtilities.py +++ b/plogical/backupUtilities.py @@ -886,18 +886,12 @@ class backupUtilities: installUtilities.reStartLiteSpeed() - if ProcessUtilities.decideDistro() == ProcessUtilities.centos: - groupName = 'nobody' - else: - groupName = 'nogroup' + ## Fix permissions - command = "chown -R " + externalApp + ":%s " % (groupName) + websiteHome - cmd = shlex.split(command) - subprocess.call(cmd) + from filemanager.filemanager import FileManager - command = 'chmod 750 %s' % (websiteHome) - cmd = shlex.split(command) - subprocess.call(cmd) + fm = FileManager(None, None) + fm.fixPermissions(masterDomain) except BaseException as msg: status = os.path.join(completPath, 'status') diff --git a/plogical/filemanager.py b/plogical/filemanager.py deleted file mode 100755 index 93ff1f561..000000000 --- a/plogical/filemanager.py +++ /dev/null @@ -1,40 +0,0 @@ -from plogical import CyberCPLogFileWriter as logging -import argparse -from random import randint - -class filemanager: - - @staticmethod - def createTemporaryFile(domainName): - try: - - path = "/home/" + domainName + "/..filemanagerkey" - - fileKey = str(randint(1000, 9999)) - - filemanager = open(path,'w') - filemanager.write(fileKey) - filemanager.close() - - print(fileKey) - - except BaseException as msg: - logging.CyberCPLogFileWriter.writeToFile( - str(msg) + " [createTemporaryFile]") - print("0," + str(msg)) - - -def main(): - - parser = argparse.ArgumentParser(description='CyberPanel Filemanager') - parser.add_argument('function', help='Specific a function to call!') - parser.add_argument('--domainName', help='Domain name!') - - - args = parser.parse_args() - - if args.function == "createTemporaryFile": - filemanager.createTemporaryFile(args.domainName) - -if __name__ == "__main__": - main() \ No newline at end of file diff --git a/plogical/processUtilities.py b/plogical/processUtilities.py index 1bfe9b31b..ce5e03d10 100755 --- a/plogical/processUtilities.py +++ b/plogical/processUtilities.py @@ -263,12 +263,17 @@ class ProcessUtilities(multi.Thread): def customPoen(self): try: + + if type(self.extraArgs['command']) == str or type(self.extraArgs['command']) == bytes: command = self.extraArgs['command'] else: command = " ".join(self.extraArgs['command']) - ProcessUtilities.sendCommand(command, self.extraArgs['user']) + if getpass.getuser() == 'root': + subprocess.call(command, shell=True) + else: + ProcessUtilities.sendCommand(command, self.extraArgs['user']) return 1 except BaseException as msg: