How to fix file system problems in Laravel - laravel

I want to ask when I move the Laravel project to VPS an error like this appears.
https://i.postimg.cc/mr4bB9WX/Screenshot-18.jpg
What I have done is:
$ sudo chown -R $USER:www-data storage
$ sudo chown -R $USER:www-data bootstrap/cache
$ chmod -R 775 storage
$ chmod -R 775 bootstrap/cache
# composer update

go to your project folder and open terminal.
run this command
sudo chmod -R 777 theme/gallery

You may do it like like so.
sudo chmod -R 755 theme/gallery

Related

MacOS, insecure files/directory (zsh compinit)

My shell tells me the following:
❯ compaudit
There are insecure files:
/usr/local/share/zsh/site-functions/_brew
I tried fixing this using $ sudo chmod -R 755 /usr/local/share/zsh/site-functions/_brew and $ sudo chown -R root:staff /usr/local/share/zsh/site-functions/_brew but that didnt help.
The only other solution I have found was to add ZSH_DISABLE_COMPFIX=true into my ~./zshrc file. But isnt that just a workaround to ignore the problem?
I found the solution:
The file that was making problems (/usr/local/share/zsh/site-functions/_brew) was linking to another file (/usr/local/Homebrew/completions/zsh/_brew).
So I ran these 2 commands and I was fine:
$ sudo chmod -R 755 /usr/local/Homebrew/completions/zsh/_brew
$ sudo chown -R root:staff /usr/local/Homebrew/completions/zsh/_brew
Change directory (cd) into
/usr/local/share/zsh/site-functions/_brew
and then run
sudo chmod -R 755 /usr/local/share/zsh/site-functions/_brew
This worked for me.

laravel centOS 8 "log file could not be opened in append mode: failed to open stream: Permission denied”

Generally in ubuntu changing ownership to www-data and 775 permission solve this problem. But in centos 8 this seems not enough. What I did is-
Set SELinux in permissive mode
Allow to write in the laravel storage folder - chcon -R -t httpd_sys_rw_content_t storage
sudo chown -R nginx:nginx /path/to/your/laravel/root/directory
chmod -R 775 storage/
Reboot the system
Nothing is working. What to do solve this problem?
From the projects root folder try:
sudo chmod -R gu+w storage/
sudo chmod -R guo+w storage/
sudo chmod -R gu+w bootstrap/cache/
sudo chmod -R guo+w bootstrap/cache/
Turns out the issue is with selinux
This worked for me
sudo chcon -R -t httpd_sys_rw_content_t /path/to/log/directory
In CentOS I just solved with this:
chcon -R -t httpd_sys_rw_content_t storage/
Credits: https://laravelquestions.com/2020/10/27/laravel-the-stream-or-file-storage-laravel-log-could-not-be-opened-in-append-mode-failed-to-open-stream-permission-denied-in-rhel8/#google_vignette

macOS - Permission denied # apply2files - /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store?

I was installing the starship via homebrew, but I am getting this error:
Permission denied # apply2files - /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store
Any solution for fixing this error?
Thanks.
This issue appeared after upgrading macOS to Mojave 10.14.X onwards.
Therefore, you need to reset the permissions in /usr/local:
sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
Source: https://github.com/Homebrew/homebrew-core/issues/45009#issuecomment-543795948
You can change owner by :
sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules
If you are getting the above error during brew cleanup “Permission denied # apply2files”, one of the solutions which worked in my case was to reset permissions to /usr/local. You will have to rewrite permission to the current user. In your terminal copy and paste:
sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
Then rerun the command. The permission error should go.
Hope it may help someone in the future. Good luck
Change permission of the node_modules directory by running
sudo chown -R ${LOGNAME}:staff /usr/local/lib/node_modules
You can run the command:
sudo chmod 755 /usr/local/lib/node_modules/expo-cli/node_modules/extglob/lib/.DS_Store
first
sudo chown -R $(whoami):admin /usr/local/* \
&& sudo chmod -R g+rwx /usr/local/*
the reinstall all the packages with
brew list --formula | xargs brew reinstall
this part may take few minutes but worked great for me
This work for me.
Remove and reinstall brew.
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
In my case, It works with
sudo chown -R douglas.mesquita:admin /usr/local/lib/node_modules
what worked for me, simply delete the directory with
sudo rm -rf %error file path%

Syntax error, space in the username command

I'm trying to change the owner and the group of a directory and any subdirectories and archives in a centos sytem
I'm using this commands:
chown -R mc4380 [502] /home/minecraft/multicraft/servers/server4380
chgrp -R mc4380 [502] /home/minecraft/multicraft/servers/server4380
The way to directory is:
/home/minecraft/multicraft/servers/server4380
And the new owner and group are:
mc4380 [502]
The problem is the space in the mc4380 [502], I receive this error when I execute the command:
chown: cannot access `[502]': No such file or directory
I Already tried this and don't worked:
chown -R "mc4380 [502]" /home/minecraft/multicraft/servers/server4380
chown -R 'mc4380 [502]' /home/minecraft/multicraft/servers/server4380
chown -R mc4380\ [502] /home/minecraft/multicraft/servers/server4380
everytime receiving this:
chown: invalid user: `mc4380 [502]'
But the user/group exists and are okay, and when i used this command:
chown -R new_owner:new_group /directory
Him understood the first argument changing successful the owner of the archives/directory and subdirectorys
Oh, sorry my bad english, I tried to do my best
Try this command:
chown -R mc4380\ \[502\] /home/minecraft/multicraft/servers/server4380

Cannot change file ownership from bash script

I am trying to run the command
chown -R "$USER" /mnt/namenode
from a bash script to change the ownership of the namenode folder and its sub-folders. When I type the command manually
sudo chown -R ubuntu /mnt/namenode
it works, but not when I do it from the script. From the script, only the ownership of the namenode is changing, not its subfolders. Does anyone know how I might fix this?
OK, I got it. My script was formatting the namenode after the ownership had been set. Before the format, the subfolders has the correct ownership recursively. After the format, the sub-folders' ownership was changing to root. So I made the following change:
echo 'Y' | /home/$USER/hadoop-2.2.0/bin/hadoop namenode -format
sudo chown -R $USER:$USER /mnt/namenode
sudo chown -R $USER:$USER /mnt/datanode
In other words, I set the ownership after I did the formatting.
Try this:
chown -R $USER:$USER /mnt/namenode
If you run the script with sudo (as you are doing), inside the script $USER will be root not the normal user.
So use sudo inside the script:
sudo chown -R "$USER" /mnt/namenode
and run the script without sudo.
I just have the same problem.
Try to add the slash at the end of folder as:
chown -R "$USER" /mnt/namenode/

Resources