change permissions structure

This commit is contained in:
Usman Nasir
2020-02-21 17:36:09 +05:00
parent 1baabda918
commit 794a4f66f9
2 changed files with 21 additions and 15 deletions

View File

@@ -53,10 +53,10 @@ def changePermissions(request):
website = Websites.objects.get(domain=domainName)
externalApp = website.externalApp
command = "sudo chown -R " + externalApp + ":" + externalApp +" /home/"+domainName
command = "chown -R " + externalApp + ":" + externalApp +" /home/"+domainName
ProcessUtilities.popenExecutioner(command)
command = "sudo chown -R lscpd:lscpd /home/" + domainName+"/logs"
command = "chown root:nobody /home/" + domainName+"/logs"
ProcessUtilities.popenExecutioner(command)
command = "find %s -type d -exec chmod 0755 {} \;" % ("/home/" + domainName + "/public_html")
@@ -65,6 +65,12 @@ def changePermissions(request):
command = "find %s -type f -exec chmod 0644 {} \;" % ("/home/" + domainName + "/public_html")
ProcessUtilities.popenExecutioner(command)
command = 'chown %s:nobody /home/%s/public_html' % (externalApp, domainName)
ProcessUtilities.executioner(command)
command = 'chmod 750 /home/%s/public_html' % (domainName)
ProcessUtilities.executioner(command)
data_ret = {'permissionsChanged': 1, 'error_message': "None"}
json_data = json.dumps(data_ret)
return HttpResponse(json_data)

View File

@@ -358,7 +358,7 @@ class ApplicationInstaller(multi.Thread):
##
command = "chown -R " + externalApp + ":" + externalApp + " " + finalPath
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command, externalApp)
statusFile = open(tempStatusPath, 'w')
@@ -374,7 +374,7 @@ class ApplicationInstaller(multi.Thread):
homeDir = "/home/" + domainName + "/public_html"
if not os.path.exists(homeDir):
command = "chown -R " + externalApp + ":" + externalApp + " " + homeDir
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
ProcessUtilities.executioner(command, externalApp)
try:
@@ -521,15 +521,15 @@ class ApplicationInstaller(multi.Thread):
##
command = "sudo rm -rf " + finalPath + "install"
command = "rm -rf " + finalPath + "install"
ProcessUtilities.executioner(command, externalApp)
##
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command, externalApp)
command = "sudo rm -f prestashop_1.7.4.2.zip"
command = "rm -f prestashop_1.7.4.2.zip"
ProcessUtilities.executioner(command, externalApp)
statusFile = open(tempStatusPath, 'w')
@@ -544,7 +544,7 @@ class ApplicationInstaller(multi.Thread):
homeDir = "/home/" + domainName + "/public_html"
if not os.path.exists(homeDir):
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
ProcessUtilities.executioner(command, externalApp)
try:
@@ -651,7 +651,7 @@ class ApplicationInstaller(multi.Thread):
##
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command, externalApp)
vhost.addRewriteRules(domainName)
@@ -704,7 +704,7 @@ class ApplicationInstaller(multi.Thread):
website = Websites.objects.get(domain=domain)
externalApp = website.externalApp
command = "chown -R " + externalApp + ":" + externalApp + " " + finalPath
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command, externalApp)
return 0
@@ -743,7 +743,7 @@ class ApplicationInstaller(multi.Thread):
##
command = "chown -R " + externalApp + ":" + externalApp + " " + finalPath
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command, website.externalApp)
gitPath = '/home/cyberpanel/' + domain + '.git'
@@ -891,7 +891,7 @@ class ApplicationInstaller(multi.Thread):
shutil.rmtree(finalPath + "installation")
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + finalPath
command = "chown -R " + virtualHostUser + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command)
vhost.addRewriteRules(domainName)
@@ -909,7 +909,7 @@ class ApplicationInstaller(multi.Thread):
homeDir = "/home/" + domainName + "/public_html"
if not os.path.exists(homeDir):
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
command = "chown -R " + virtualHostUser + ":" + 'nobody' + " " + homeDir
ProcessUtilities.executioner(command)
try:
@@ -1101,7 +1101,7 @@ class ApplicationInstaller(multi.Thread):
##
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
ProcessUtilities.executioner(command, externalApp)
installUtilities.reStartLiteSpeed()
@@ -1118,7 +1118,7 @@ class ApplicationInstaller(multi.Thread):
homeDir = "/home/" + domainName + "/public_html"
if not os.path.exists(homeDir):
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
ProcessUtilities.executioner(command, externalApp)
try: