mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-07 22:06:05 +01:00
change permissions structure
This commit is contained in:
@@ -53,10 +53,10 @@ def changePermissions(request):
|
|||||||
website = Websites.objects.get(domain=domainName)
|
website = Websites.objects.get(domain=domainName)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp +" /home/"+domainName
|
command = "chown -R " + externalApp + ":" + externalApp +" /home/"+domainName
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
|
|
||||||
command = "sudo chown -R lscpd:lscpd /home/" + domainName+"/logs"
|
command = "chown root:nobody /home/" + domainName+"/logs"
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
|
|
||||||
command = "find %s -type d -exec chmod 0755 {} \;" % ("/home/" + domainName + "/public_html")
|
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")
|
command = "find %s -type f -exec chmod 0644 {} \;" % ("/home/" + domainName + "/public_html")
|
||||||
ProcessUtilities.popenExecutioner(command)
|
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"}
|
data_ret = {'permissionsChanged': 1, 'error_message': "None"}
|
||||||
json_data = json.dumps(data_ret)
|
json_data = json.dumps(data_ret)
|
||||||
return HttpResponse(json_data)
|
return HttpResponse(json_data)
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
@@ -374,7 +374,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -521,15 +521,15 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo rm -rf " + finalPath + "install"
|
command = "rm -rf " + finalPath + "install"
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
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)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
statusFile = open(tempStatusPath, 'w')
|
statusFile = open(tempStatusPath, 'w')
|
||||||
@@ -544,7 +544,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
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)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
@@ -704,7 +704,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
website = Websites.objects.get(domain=domain)
|
website = Websites.objects.get(domain=domain)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
command = "chown -R " + externalApp + ":" + externalApp + " " + finalPath
|
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
return 0
|
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)
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
gitPath = '/home/cyberpanel/' + domain + '.git'
|
gitPath = '/home/cyberpanel/' + domain + '.git'
|
||||||
@@ -891,7 +891,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
shutil.rmtree(finalPath + "installation")
|
shutil.rmtree(finalPath + "installation")
|
||||||
|
|
||||||
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + finalPath
|
command = "chown -R " + virtualHostUser + ":" + 'nobody' + " " + finalPath
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
@@ -909,7 +909,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "chown -R " + virtualHostUser + ":" + virtualHostUser + " " + homeDir
|
command = "chown -R " + virtualHostUser + ":" + 'nobody' + " " + homeDir
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
try:
|
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)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1118,7 +1118,7 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " " + homeDir
|
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
Reference in New Issue
Block a user