diff --git a/Makefile b/Makefile index c1bbb4f..7775500 100644 --- a/Makefile +++ b/Makefile @@ -21,7 +21,7 @@ INSTALL = install -p INSTALL_PROGRAM = $(INSTALL) -m755 INSTALL_DATA = $(INSTALL) -m644 INSTALL_DIR = $(INSTALL) -d -INSTALL_WORLDDIR = $(INSTALL) -dm777 +INSTALL_WORLDDIR = $(INSTALL) -dm755 Q = @ diff --git a/docs/monitorix.spec b/docs/monitorix.spec index 9871c3e..4298a7f 100644 --- a/docs/monitorix.spec +++ b/docs/monitorix.spec @@ -85,7 +85,7 @@ rm -rf %{buildroot} %{_localstatedir}/lib/monitorix/www/logo_bot.png %{_localstatedir}/lib/monitorix/www/monitorixico.png %{_localstatedir}/lib/monitorix/www/cgi/monitorix.cgi -%attr(777,root,root) %{_localstatedir}/lib/monitorix/www/imgs +%attr(755,root,root) %{_localstatedir}/lib/monitorix/www/imgs %attr(755,root,root) %{_localstatedir}/lib/monitorix/usage %{_localstatedir}/lib/monitorix/reports/*.html %doc %{_mandir}/man5/monitorix.conf.5.gz diff --git a/monitorix b/monitorix index 46f60a6..6dd231c 100755 --- a/monitorix +++ b/monitorix @@ -2,7 +2,7 @@ # # Monitorix - A lightweight system monitoring tool. # -# Copyright (C) 2005-2017 by Jordi Sanfeliu +# Copyright (C) 2005-2018 by Jordi Sanfeliu # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -670,6 +670,12 @@ create_index(); # start the HTTP built-in (if enabled) if(lc($config{httpd_builtin}->{enabled}) eq "y") { + logger("Setting owner/group and permission bits for the imgs/ directory.") if defined($options{d}); + my (undef, undef, $uid) = getpwnam($config{httpd_builtin}->{user}); + my (undef, undef, $gid) = getgrnam($config{httpd_builtin}->{group}); + chown($uid, $gid, $config{base_dir} . "/" . $config{imgs_dir}); + chmod(0755, $config{base_dir} . "/" . $config{imgs_dir}); + require HTTPServer; httpd_setup(\%config, $options{d}); logger("Started built-in HTTP server (pid $config{httpd_pid}).") if (defined($config{httpd_pid}));