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)