File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -179,11 +179,22 @@ create_user () {
179179
180180 if [[ " $distro " == " Ubuntu" ]] || [[ " $distro " == " Debian" ]] || [[ " $distro " == " Raspbian" ]] ; then
181181 /usr/sbin/adduser --quiet --disabled-password --gecos ' Snipe-IT User' " $APP_USER "
182- su -c " /usr/sbin/usermod -a -G " $apache_group " " $APP_USER " "
183182 else
184- adduser " $APP_USER "
185- usermod -a -G " $apache_group " " $APP_USER "
183+ adduser -c " Snipe-IT User" " $APP_USER "
186184 fi
185+
186+ # Add the user to the apache group so the app can write to any files apache
187+ # creates (eg, if apache process creates the log, but then a an app-user-owned
188+ # cron also tries writing
189+ usermod -a -G " $apache_group " " $APP_USER "
190+
191+ # Now do the reverse -- so apache can write to the log that the user may
192+ # have created. This was actively a problem on new installs, hobbling
193+ # imports
194+ # redefining these variables just for clarity
195+ apache_user=" $apache_group "
196+ app_group=" $APP_USER "
197+ usermod -a -G " $app_group " " $apache_user "
187198}
188199
189200run_as_app_user () {
You can’t perform that action at this time.
0 commit comments