Problem with directory / file permissions after SnipeIT upgrades
Expected Behavior (or desired behavior if a feature request)
After an upgrade of SnipeIT to the latest version, I expect that all permissions are still configured correctly and I do not run chmod g+rwx -R . on /var/www/html/snipe-it again.
Actual Behavior
Every time when I run the "php ./upgrade.php " from /var/www/html/snipe-it/ (today again, from 4.6.13 to 4.6.14)
Please confirm you have done the following before posting your bug report:
- [ ] I have enabled debug mode
- [x ] I have read checked the Common Issues page
Provide answers to these questions:
- Is this a fresh install or an upgrade? Upgrade from 4.6.13 to 4.6.14
- Version of Snipe-IT you're running - 4.6.14
- Version of PHP you're running - 7.0.33-0+deb9u3
- Version of MySQL/MariaDB you're running - mysql Ver 15.1 Distrib 10.1.37-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
- What OS and web server you're running Snipe-IT on - Debian 9.8, Server version: Apache/2.4.25 (Debian)
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) - upgrade.php
- Any errors that appear in your browser's error console. - Website no longer accessible
- Include any additional information you can find in
storage/logsand your webserver's logs. - No
Who is the owner of the files and what user are you using to run the upgrade.php script?
The owner of /var/www/html/snipe-it is the user snipeit and I'm running the upgrade.php under this user shell.
drwxrwx--- 16 snipeit www-data 4096 Mar 19 09:07 . drwxr-xr-x 4 root root 4096 Mar 2 2018 .. -rw-rwx--- 1 snipeit www-data 44773 Mar 19 09:07 .all-contributorsrc drwxrwx--- 17 snipeit www-data 4096 Jan 31 2018 app -rw-rwx--- 1 snipeit www-data 1646 Jan 31 2018 artisan drwxrwx--- 3 snipeit www-data 4096 Jan 31 2018 bootstrap -rw-rwx--- 1 snipeit www-data 875 Jan 31 2018 bower.json -rw-rwx--- 1 snipeit www-data 9210 Jan 31 2018 c3.php -rw-rwx--- 1 snipeit www-data 373 Jan 31 2018 codeception.yml -rw-rwx--- 1 snipeit www-data 3228 Jan 31 2018 CODE_OF_CONDUCT.md -rw-rwx--- 1 snipeit www-data 2336 Jan 28 09:13 composer.json -rw-rwx--- 1 snipeit www-data 233727 Jan 28 09:13 composer.lock -rwxrwxr-x 1 snipeit www-data 1861877 Feb 1 2018 composer.phar drwxrwx--- 2 snipeit www-data 4096 Mar 19 09:07 config -rw-rwx--- 1 snipeit www-data 317 Jan 31 2018 CONTRIBUTING.md -rw-rwx--- 1 snipeit www-data 90 Jan 31 2018 crowdin.yml drwxrwx--- 5 snipeit www-data 4096 Jan 31 2018 database drwxrwx--- 2 snipeit www-data 4096 Mar 19 09:07 docker -rw-rwx--- 1 snipeit www-data 3265 Mar 19 09:07 Dockerfile -rw-rwx--- 1 snipeit www-data 67 Jan 31 2018 .dockerignore -rw-rwx--- 1 snipeit www-data 2875 May 9 2018 .env -rw-rwx--- 1 snipeit www-data 2951 Jan 28 09:13 .env.example -rw-rwx--- 1 snipeit www-data 1826 Jan 31 2018 .env.testing -rw-rwx--- 1 snipeit www-data 1755 Jan 31 2018 .env.testing-ci -rw-rwx--- 1 snipeit www-data 536 Mar 2 2018 .env.tests -rw-rwx--- 1 snipeit www-data 491 Mar 2 2018 .env.unit-tests -rw-rwx--- 1 snipeit www-data 1711 Jan 31 2018 gh-changelog.php drwxrwx--- 8 snipeit www-data 4096 Mar 19 09:07 .git -rwxrwx--- 1 snipeit www-data 11 Jan 31 2018 .gitattributes drwxrwx--- 3 snipeit www-data 4096 Mar 19 09:07 .github -rwxrwx--- 1 snipeit www-data 1077 Jan 28 09:13 .gitignore -rw-rwx--- 1 snipeit www-data 251 Jan 31 2018 .htaccess -rw-rwx--- 1 snipeit www-data 956 Jan 31 2018 index.html -rwxrwx--- 1 snipeit www-data 371 Jan 31 2018 install.sh -rwxrwx--- 1 snipeit www-data 34519 Jan 31 2018 LICENSE -rw-rwx--- 1 root root 1433748 Mar 23 2018 nachher -rw-rwx--- 1 snipeit www-data 450983 Jul 20 2018 npm-shrinkwrap.json -rw-rwx--- 1 snipeit www-data 1760 May 4 2018 package.json -rw-rwx--- 1 snipeit www-data 1097 Mar 2 2018 phpunit.xml drwxrwx--- 8 snipeit www-data 4096 Mar 19 09:07 public -rw-rwx--- 1 snipeit www-data 45765 Mar 19 09:07 README.md drwxrwx--- 6 snipeit www-data 4096 Jan 31 2018 resources drwxrwx--- 3 snipeit www-data 4096 Mar 19 09:07 routes drwxrwx--- 2 snipeit www-data 4096 Mar 23 2018 sample_csvs -rw-rwx--- 1 snipeit www-data 567 Jan 31 2018 server.php -rwxrwx--- 1 snipeit www-data 21737 Jul 26 2018 snipeit.sh drwxrwx--- 8 snipeit www-data 4096 Mar 2 2018 storage drwxrwx--- 10 snipeit www-data 4096 May 4 2018 tests -rw-rwx--- 1 snipeit www-data 2819 Feb 18 08:10 .travis.yml -rw-rwx--- 1 root root 509567 Mar 23 2018 unterschied -rw-rwx--- 1 snipeit www-data 6229 Jan 28 09:13 upgrade.php -rw-rwx--- 1 snipeit www-data 3435 Jul 10 2018 Vagrantfile drwxrwx--- 52 snipeit www-data 4096 Mar 19 09:07 vendor -rw-rwx--- 1 root root 1433688 Mar 23 2018 vorher -rw-rwx--- 1 snipeit www-data 2133 Jan 31 2018 webpack.mix.js
Hi, I've had to reapply permissions to things I have already applied permissions to so you should run your command again: chmod g+rwx -R . on /var/www/html/snipe-it
OR Also you should try the following: https://snipe-it.readme.io/docs/common-issues
Quick Tip: Handy Commands Many issues can be resolved if you remember to run the following commands when you encounter weird errors: These commands should be run from your Snipe-IT project root, just like every other cli command we mention. They should not need to be run as root/sudo/admin.
Make a backup of everything first. I believe I have read somewhere that you should run these commands after upgrades:
composer dump-autoload composer clear-compiled php artisan config:clear php artisan view:clear php artisan cache:clear php artisan route:clear
These commands clear out cached service files that help speed up modern PHP applications but can also very occasionally be out of date, resulting in odd errors. These caches will be regenerated normally, so they can be cleared without repercussion. (You can also run php update.php from the Snipe-IT project directory to run these commands and other helpful clean-up commands all at once.)
These commands should be run from your Snipe-IT project root, just like every other cli command we mention. They should not need to be run as root/sudo/admin. These commands clear out cached service files that help speed up modern PHP applications but can also very occasionally be out of date,...
@cdcs68 I do not see anything in the upgrade.php that will alter files permissions, I don't have any Snipe-IT installation on Debian based distro bit on the RHEL base, I leave the web server as the owner and execute all commands as that user. For example, on RHEL base OS apache is the user for the Apache (HTTPD) web server so I'll run sudo -u apache upgrade.php. For your next upgrade can you doucment the permission before and after an upgrade?
This is the same command "chmod g+rwx -R ." which I need to run after an upgrade every time. If I do not reapply the permissions, the webiste of our snipeit installation cannot be displayed, just a white / blank screen. If you run the command on /var/www/html/snipe-it, the correct permissions will be applied again and I can visit our snipeit site properly
@dvogelho, are you also running Debian, what method was used during the original installation.
@EarlRamirez, yes like described above and git was used for the initial installation
@EarlRamirez Yes, I can do that. And if I can find the document/website that mentioned reapplying the permissions, I'll post the link. Will look for them today.
Yeah, nothing in that upgrade.php script does anything to permissions on files or folders.
@EarlRamirez - I agree and understand that nothing should occur that would impact permissions during an upgrade; however, I have definitely experienced this problem at least once. It has been a long while back. Have you tried running the commands I previously posted? Does your snipeit user account have permissions to the www-data group? Seems like it would need it. Even though I'm the administrator of our Snipe IT server, I don't work with Snipe IT on a daily or monthly basis. So I don't recall exactly what the permissions are supposed to look like without diving back into it. So double check should you want to explore this.
In the meantime, it shouldn't hurt to re-run the command to apply the permissions.
Also this might help? https://www.digitalocean.com/community/tutorials/how-to-install-snipe-it-on-ubuntu-16-04
Or this: https://github.com/snipe/snipe-it/issues/6833 The Snipe IT Common Issues page show
Error: Insufficient permissions! after upgrading While older versions of Snipe can be updated rather painlessly by simply using php artisan migrate, when upgrading from ancient versions (i.e. v1.1) to newer versions you may experience issues with user deletion, viewing backups etc.
This is due to the fact that migrations will not automatically add "Admin" users to the new "Super User" permission group.
To resolve (without raw SQL/db queries) try the following:
login as an admin user create a new (throw away) admin user with Super User permissions log out and log back in as new user elevate all the users who need Super User log out and back into your regular admin account that has just been elevated delete the throw away user you created earlier to ensure elevation worked
Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail. This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!
This issue has been automatically closed because it has not had recent activity. If you believe this is still an issue, please confirm that this issue is still happening in the most recent version of Snipe-IT and reply to this thread to re-open it.