From b62403bf7164e55e0533e610c1d2ef1f8a4d9eb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrew=20Lee=20=28=E6=9D=8E=E5=81=A5=E7=A7=8B=29?= Date: Tue, 11 Sep 2018 18:08:01 +0800 Subject: [PATCH] Update correct group permission for rb_sysopen MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The rb_sysopen runs as www-data that needs to access to production.log, backend_access.log and database.yml. Revert the group owner to www-data to avoid following errors: Rails Error: Unable to access log file. Please ensure that /usr/share/obs/api/log/production.log exists and is writable (ie, make it writable for user and group: chmod 0664 /usr/share/obs/api/log/production.log). The log level has been raised to WARN and the output directed to STDERR until the problem is fixed. rake aborted! Errno::EACCES: Cannot load `Rails.application.database_configuration`: Permission denied @ rb_sysopen - /usr/share/obs/api/config/database.yml /usr/share/obs/api/config/environment.rb:30:in `' Errno::EACCES: Permission denied @ rb_sysopen - /usr/share/obs/api/config/database.yml /usr/share/obs/api/config/environment.rb:30:in `' Tasks: TOP => environment (See full trace by running task with --trace) Errno::EACCES: Permission denied @ rb_sysopen - /usr/share/obs/api/log/backend_access.log /usr/share/obs/api/lib/opensuse/backend.rb:14:in `new' /usr/share/obs/api/lib/opensuse/backend.rb:14:in `' /usr/share/obs/api/lib/opensuse/backend.rb:6:in `' /usr/share/obs/api/lib/opensuse/backend.rb:5:in `' /usr/share/obs/api/app/models/project.rb:1:in `' /usr/share/obs/api/app/indices/project_index.rb:2:in `block in ' Tasks: TOP => ts:index (See full trace by running task with --trace) Signed-off-by: Andrew Lee (李健秋) --- debian/rake-tasks.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/debian/rake-tasks.sh b/debian/rake-tasks.sh index 8044fa6..154900a 100755 --- a/debian/rake-tasks.sh +++ b/debian/rake-tasks.sh @@ -26,10 +26,10 @@ case "$1" in chown -R www-data:www-data /usr/share/obs/api/public chown www-data:www-data /etc/obs/api/config/production.sphinx.conf chmod 664 /var/log/obs/*.log - chown obsapi:obsapi /etc/obs/api/config/database.yml + chown obsapi:www-data /etc/obs/api/config/database.yml chmod 440 /etc/obs/api/config/database.yml - chown obsapi:obsapi /var/log/obs/backend_access.log - chown obsapi:obsapi /var/log/obs/production.log + chown obsapi:www-data /var/log/obs/backend_access.log + chown obsapi:www-data /var/log/obs/production.log # Generate Gemfile.lock file. cd /usr/share/obs/api -- GitLab