mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2025-11-18 03:01:01 +01:00
bug fix: permissions on ubuntu
This commit is contained in:
@@ -498,13 +498,18 @@ class FileManager:
|
|||||||
website = Websites.objects.get(domain=domainName)
|
website = Websites.objects.get(domain=domainName)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
command = 'chown -R %s:%s /home/%s/public_html/*' % (externalApp, externalApp, domainName)
|
command = 'chown -R %s:%s /home/%s/public_html/*' % (externalApp, externalApp, domainName)
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
|
|
||||||
command = 'chown -R %s:%s /home/%s/public_html/.[^.]*' % (externalApp, externalApp, domainName)
|
command = 'chown -R %s:%s /home/%s/public_html/.[^.]*' % (externalApp, externalApp, domainName)
|
||||||
ProcessUtilities.popenExecutioner(command)
|
ProcessUtilities.popenExecutioner(command)
|
||||||
|
|
||||||
command = "chown root:nobody /home/" + domainName + "/logs"
|
command = "chown root:%s /home/" % (groupName) + 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")
|
||||||
@@ -513,7 +518,7 @@ class FileManager:
|
|||||||
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)
|
command = 'chown %s:%s /home/%s/public_html' % (externalApp,groupName, domainName)
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
command = 'chmod 750 /home/%s/public_html' % (domainName)
|
command = 'chmod 750 /home/%s/public_html' % (domainName)
|
||||||
|
|||||||
@@ -351,8 +351,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if home != '0':
|
if home != '0':
|
||||||
command = "chown " + externalApp + ":" + 'nobody' + " " + finalPath
|
command = "chown " + externalApp + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
command = 'chmod 750 %s' % (self.permPath)
|
command = 'chmod 750 %s' % (self.permPath)
|
||||||
@@ -370,8 +375,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "chown " + externalApp + ":" + 'nobody' + " " + homeDir
|
command = "chown " + externalApp + ":" + groupName + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -523,8 +533,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if home == '0':
|
if home == '0':
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
command = "chown -R " + externalApp + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
command = "rm -f prestashop_1.7.4.2.zip"
|
command = "rm -f prestashop_1.7.4.2.zip"
|
||||||
@@ -544,8 +559,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
|
command = "chown -R " + externalApp + ":" + groupName + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -652,7 +672,12 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "chown -R " + externalApp + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
@@ -714,10 +739,15 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
website = Websites.objects.get(domain=domain)
|
website = Websites.objects.get(domain=domain)
|
||||||
externalApp = website.externalApp
|
externalApp = website.externalApp
|
||||||
|
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
command = "chown -R " + externalApp + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
@@ -756,7 +786,12 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "chown -R " + externalApp + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, website.externalApp)
|
ProcessUtilities.executioner(command, website.externalApp)
|
||||||
|
|
||||||
gitPath = '/home/cyberpanel/' + domain + '.git'
|
gitPath = '/home/cyberpanel/' + domain + '.git'
|
||||||
@@ -906,7 +941,12 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
shutil.rmtree(finalPath + "installation")
|
shutil.rmtree(finalPath + "installation")
|
||||||
|
|
||||||
command = "chown -R " + virtualHostUser + ":" + 'nobody' + " " + finalPath
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "chown -R " + virtualHostUser + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
vhost.addRewriteRules(domainName)
|
vhost.addRewriteRules(domainName)
|
||||||
@@ -927,8 +967,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "chown -R " + virtualHostUser + ":" + 'nobody' + " " + homeDir
|
command = "chown -R " + virtualHostUser + ":" + groupName + " " + homeDir
|
||||||
ProcessUtilities.executioner(command)
|
ProcessUtilities.executioner(command)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -1120,8 +1165,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
##
|
##
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if home != '0':
|
if home != '0':
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + finalPath
|
command = "chown -R " + externalApp + ":" + groupName + " " + finalPath
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
@@ -1140,8 +1190,13 @@ class ApplicationInstaller(multi.Thread):
|
|||||||
|
|
||||||
homeDir = "/home/" + domainName + "/public_html"
|
homeDir = "/home/" + domainName + "/public_html"
|
||||||
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
if not os.path.exists(homeDir):
|
if not os.path.exists(homeDir):
|
||||||
command = "chown -R " + externalApp + ":" + 'nobody' + " " + homeDir
|
command = "chown -R " + externalApp + ":" + groupName + " " + homeDir
|
||||||
ProcessUtilities.executioner(command, externalApp)
|
ProcessUtilities.executioner(command, externalApp)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
@@ -849,7 +849,12 @@ class backupUtilities:
|
|||||||
|
|
||||||
installUtilities.reStartLiteSpeed()
|
installUtilities.reStartLiteSpeed()
|
||||||
|
|
||||||
command = "chown -R " + externalApp + ":nobody" " " + websiteHome
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "chown -R " + externalApp + ":%s " % (groupName) + websiteHome
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
|
|
||||||
|
|||||||
@@ -717,7 +717,12 @@ class cPanelImporter:
|
|||||||
command = "sudo chown -R " + externalApp + ":" + externalApp + " /home/" + self.mainDomain
|
command = "sudo chown -R " + externalApp + ":" + externalApp + " /home/" + self.mainDomain
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
command = "sudo chown -R root:nobody /home/" + self.mainDomain + "/logs"
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "sudo chown -R root:%s /home/" % (groupName) + self.mainDomain + "/logs"
|
||||||
ProcessUtilities.normalExecutioner(command)
|
ProcessUtilities.normalExecutioner(command)
|
||||||
|
|
||||||
command = "sudo find %s -type d -exec chmod 0755 {} \;" % ("/home/" + self.mainDomain + "/public_html")
|
command = "sudo find %s -type d -exec chmod 0755 {} \;" % ("/home/" + self.mainDomain + "/public_html")
|
||||||
|
|||||||
@@ -91,7 +91,12 @@ class vhost:
|
|||||||
try:
|
try:
|
||||||
os.makedirs(pathHTML)
|
os.makedirs(pathHTML)
|
||||||
|
|
||||||
command = "chown " + virtualHostUser + ":nobody " + pathHTML
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "chown " + virtualHostUser + ":%s " % (groupName) + pathHTML
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
@@ -842,7 +847,13 @@ class vhost:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
os.makedirs(path)
|
os.makedirs(path)
|
||||||
command = "chown " + virtualHostUser + ":nobody " + path
|
|
||||||
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
command = "chown " + virtualHostUser + ":%s " % (groupName) + path
|
||||||
cmd = shlex.split(command)
|
cmd = shlex.split(command)
|
||||||
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
subprocess.call(cmd, stdout=FNULL, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
|
|||||||
@@ -299,10 +299,15 @@ class virtualHostUtilities:
|
|||||||
print("0, %s file is symlinked." % (fileName))
|
print("0, %s file is symlinked." % (fileName))
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
numberOfTotalLines = int(ProcessUtilities.outputExecutioner('wc -l %s' % (fileName), 'nobody').split(" ")[0])
|
if ProcessUtilities.decideDistro() == ProcessUtilities.centos:
|
||||||
|
groupName = 'nobody'
|
||||||
|
else:
|
||||||
|
groupName = 'nogroup'
|
||||||
|
|
||||||
|
numberOfTotalLines = int(ProcessUtilities.outputExecutioner('wc -l %s' % (fileName), groupName).split(" ")[0])
|
||||||
|
|
||||||
if numberOfTotalLines < 25:
|
if numberOfTotalLines < 25:
|
||||||
data = ProcessUtilities.outputExecutioner('cat %s' % (fileName), 'nobody')
|
data = ProcessUtilities.outputExecutioner('cat %s' % (fileName), groupName)
|
||||||
else:
|
else:
|
||||||
if page == 1:
|
if page == 1:
|
||||||
end = numberOfTotalLines
|
end = numberOfTotalLines
|
||||||
@@ -311,7 +316,7 @@ class virtualHostUtilities:
|
|||||||
start = 1
|
start = 1
|
||||||
startingAndEnding = "'" + str(start) + "," + str(end) + "p'"
|
startingAndEnding = "'" + str(start) + "," + str(end) + "p'"
|
||||||
command = "sed -n " + startingAndEnding + " " + fileName
|
command = "sed -n " + startingAndEnding + " " + fileName
|
||||||
data = ProcessUtilities.outputExecutioner(command, 'nobody')
|
data = ProcessUtilities.outputExecutioner(command, groupName)
|
||||||
else:
|
else:
|
||||||
end = numberOfTotalLines - ((page - 1) * 25)
|
end = numberOfTotalLines - ((page - 1) * 25)
|
||||||
start = end - 24
|
start = end - 24
|
||||||
@@ -319,7 +324,7 @@ class virtualHostUtilities:
|
|||||||
start = 1
|
start = 1
|
||||||
startingAndEnding = "'" + str(start) + "," + str(end) + "p'"
|
startingAndEnding = "'" + str(start) + "," + str(end) + "p'"
|
||||||
command = "sed -n " + startingAndEnding + " " + fileName
|
command = "sed -n " + startingAndEnding + " " + fileName
|
||||||
data = ProcessUtilities.outputExecutioner(command, 'nobody')
|
data = ProcessUtilities.outputExecutioner(command, groupName)
|
||||||
print(data)
|
print(data)
|
||||||
return data
|
return data
|
||||||
except BaseException as msg:
|
except BaseException as msg:
|
||||||
|
|||||||
Reference in New Issue
Block a user