Ramon Pego

Well-Known Member
Mar 12, 2019
62
11
8
Brazil
cPanel Access Level
Root Administrator
Twitter
Hello I am facing a very annoying and recurring problem.
I have some systems using Laravel on my CentOs 6.2
Every time the system tries to create a new file in the folder
for example
~ myapp / storage / *
He gives permission error
Even though I am giving chmod -R 777 storage /
He can create the file on time, but the other day he can't.

Already sought other solutions that is used as ubuntu for example of
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug + rwx storage bootstrap/cache

cause chgrp: invalid group: `www-data'

I searched for an equivalent in CentOs never found.

My server is CentOs CENTOS 6.10 V82.0.11 on apache2


Thx
 

Ramon Pego

Well-Known Member
Mar 12, 2019
62
11
8
Brazil
cPanel Access Level
Root Administrator
Twitter
Code:
lrwxrwxrwx  1 someusrnme someusrnme     42 Jul  4 16:50 access-logs -> /etc/apache2/logs/domlogs/someusrnme/
drwxr-xr-x 11 root             root               4096 Jul  5 16:21 app/
-rw-r--r--  1 root             root               1686 Jul  5 16:21 artisan
drwxr-xr-x  3 apache           apache             4096 Jul  5 16:21 bootstrap/
-rw-r--r--  1 root             root               2106 Jul  5 16:21 composer.json
-rw-r--r--  1 root             root             221447 Jul  5 16:21 composer.lock
drwxr-xr-x  2 root             root               4096 Aug 30 10:25 config/
drwxr-xr-x  5 root             root               4096 Jul  5 16:21 database/
drwxr-x---  3 someusrnme mail               4096 Sep  2 08:20 etc/
drwx------  2 someusrnme someusrnme   4096 Sep  1 09:05 logs/
drwxr-x--x 11 someusrnme someusrnme   4096 Sep  2 06:32 mail/
-rw-r--r--  1 root             root               1125 Jul  5 16:21 package.json
-rw-r--r--  1 root             root               1138 Jul  5 16:21 phpunit.xml
drwxr-xr-x  7 root             root               4096 Jul  5 16:21 public/
drwxr-x---  3 someusrnme someusrnme   4096 Jul  4 16:39 public_ftp/
drwxr-x---  4 someusrnme someusrnme   4096 Jul  4 16:42 public_html/
-rw-r--r--  1 root             root               4094 Jul  5 16:21 readme.md
drwxr-xr-x  6 root             root               4096 Jul  5 16:21 resources/
drwxr-xr-x  2 root             root               4096 Aug 30 15:03 routes/
-rw-r--r--  1 root             root                563 Jul  5 16:21 server.php
drwxr-xr-x  5 someusrnme someusrnme   4096 Jul  4 16:39 ssl/
drwxrwxrwx  5 apache           apache             4096 Jul  5 16:21 storage/
drwxr-xr-x  4 root             root               4096 Jul  5 16:21 tests/
drwxr-xr-x  7 someusrnme someusrnme   4096 Jul  8 09:37 tmp/
drwxr-xr-x 36 root             root               4096 Aug 12 10:00 vendor/
-rw-r--r--  1 root             root                537 Jul  5 16:21 webpack.mix.js
lrwxrwxrwx  1 someusrnme someusrnme     11 Jul  4 16:39 www -> public_html/

Today I had this same problem with a website
It was not opening at all.
I had to sort it out quickly, I gave 777 permission on the entire folder, knowing it wasn't ideal but I needed it online.
 
Last edited by a moderator:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
Why is so much of this owned by the root user? I assume that this folder you're showing is the output of what's present in /home/$user/ and most of this should have the user/group of the user. You might want to look at running something like this to fix the ownership/permissions issues: Simple Bash Script to Fix Account Permissions - The cPanel Admin - keep in mind this script is a 3rd party script and not something we can provide support for.
 
Last edited:

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
I'm not sure I understand the question here. All files associated with the account should be owned by the user/group belonging to that user or they will not be able to run.
 

Ramon Pego

Well-Known Member
Mar 12, 2019
62
11
8
Brazil
cPanel Access Level
Root Administrator
Twitter
My biggest problem is that I commonly access, create and change something with the WHM root user.
I have several clients and making this change in each user is a painful process, but this script solves the problem or even a

Bash:
chown -R user:user laravel / folder
also solve, but while I use the root user I will have this problem, but I am already working on a more correct way to do this
 

cPanelLauren

Product Owner II
Staff member
Nov 14, 2017
13,266
1,301
363
Houston
You should definitely not be using the root user when adding files to a user - this isn't a "problem" per say it's the default functionality, you should be using sudo to access items owned by that user