composer laravel create-project windows 10 mkdir permission denied - laravel

I have just installed Laravel Homestead on my computer running Windows 10 and now I'm trying to create my first project with Composer.
I have cd:ed into the right folder called Code after doing vagrant ssh.
composer create-project laravel/laravel Project1 --prefer-dist
returns an error.
[ErrorException] mkdir(): Permission denied
Must be some kind of error with Composer permissions. How can I fix it?

In Windows 10 if you face some access problems you need to run the consoles and GIT BASH with Administrator rights only

In the "Homestead.yaml" file you can configure 777 permission via the following configuration.
"dmode=777" means all directory gets 777 permission and "fmode=777" means all file gets 777 permission on "code" folder.
folders:
- map: C:/Users/NEW/code
to: /home/vagrant/code
options:
mount_options: ["dmode=777","fmode=777"]

Ensure that the directory you are using is in the xampp folder. The error happens because you do not have write permission on your project folder. Check to ensure you are creating the project on the xampp folder because, regardless of you being the local admin, you may only have read permissions on some folders. You can right-click on the folder>properties>security tab on the users, click Add then add your username and assign them Full Control, click Apply. It may take some time to apply depending on the number of projects you have. After it finishes, you should be good.
PS: This is for Windows users and I sorted this out using the same process.

I solvet it temporarily with a solution that I'm not fully satisfied with, but at least it works.
sudo chmod 777 code-folder-name
Did this in the vagrant root folder.

Related

Incorrect file permission when using Laravel Sail with Docker on Windows 11 WSL

When I launch a container from within VS Code, Laravel Sail changes the file permissions to allow me to edit them.
But the command does not work and returns the error:
chown: changing property of 'html/': operation not allowed
Because of this, I cannot edit or create new files, because the owner of the file is root:root.
How can I resolve this?

How to solve the problem of accessing the storage in Laravel folder

Faced a problem accessing the storage folder. A symbolic link was created, but when I try to access any file in the storage folder, I get an error 403 "You do not have permission to access this object. The file is not readable, or the server cannot read it." I have a second project on a local machine, everything works fine there. I tried to give 777 permissions to the storage folder, but this causes the "Permisson denied" error. I will be glad to any help!
Macos catalina
Laravel Permissions
first change ownership of the laravel directory to our web group.
sudo chown -R :www-data /var/www/laravel
Next we need to give the web group write privileges over our storage directory so it can write to this folder.
sudo chmod -R 775 /var/www/laravel/storage
where laravel is the name of the root

How to edit files which are made by Laradock workspace

I've newly started to use Laradock to build my Laravel projects but I have a problem in editing the files such as Controllers, Models, etc which are made by the php artisan command in the Laradock workspace. The reason is the user in the workspace is a root and on the other side, I'm trying to edit the file in my editor by a common user. So every time I have to run the command chmod -R 777 /newCreatedFile.php to change the permission. So is there any solution to handle this problem?
By the way my OS is ubuntu 18.04
In the Laradock Getting Started guide, it explains how to get Laradock running as a specified user:
Note: You can add --user=laradock to have files created as your host’s user. Example:
docker-compose exec --user=laradock workspace bash
I believe this should solve your issue, as you will no longer have the Docker user running these commands. Try it out!
Note: The core issue may just be that whatever user Laradock is running as is not creating files with group permissions that allows the host machine's user write capabilities, hence why the --user flag can be used. It may not actually be running as the root user itself.

Permission denied when starting .bashrc on ubuntu on windows

I wanted to add a path to my .bashrc file on Ubuntu on Windows.
Since then, I get always:
/home/gian1312/.bashrc: Permission denied
I deleted all my changes. It did not help.
Then I opened the .profile file to add the path there. --> Now I get:
/home/gian1312/.profile permission denied
I deleted all my changes. All edits were made by Notepad++ in Windows.
I am looking for a solution for several days. Probably a reinstallation would help but as long as I do not know the reason I do not want to risk to face the same problem.
Best Regards and thanks a lot
Gian
The error simply says that permission denied. Since the question is not completely clear, the following things can be tried:
1) Check the permission of the file ".bashrc" and ".profile" and make sure it is 0644
2) Check the upper level directory permission (here the folder /home/gian1312) and make sure it is 0755.
3) If the first two are fine, then you need to check the permission of the "path" which you are trying to add and it should have enough permissions to be readable by the user "gian1312"
Editing the answer as per the below comment:
To change the permissions, please run the below commands:
chmod 0755 /home/gian1312
chmod 0644 /home/gian1312/.bashrc
chmod 0644 /home/gian1312/.profile

Magento Permissions

I have just moved my Magento store from cPanel to DirectAdmin (Centos).
My problem is now with permissions. Previously on cPanel all folders were set to 755 and files 644. This worked great.
However on DirectAdmin the only way I seem to be able to get everything to work (including the downloader) is by setting all folders to 777. Is this safe to do so?
Also what should the User and Group ownership be set to?
Thanks!
Followed this and everything seems to be working well:
http://blog.nexcess.net/2010/12/06/securing-magento-file-directory-permissions/
chmod may not be your problem. Who is the owner of the files on new server? Set the ownership via chown to www-data (ubuntu) or whatever they should be on centos. They way you can find this out is by setting all to 777 then look at the some newly created file, from var/log or var/session and see who is the owner/group. Reset back to varien's recommended chmod settings and do the chown user:group on all files.
Its not good to have 777 on all your folders as it makes it publicly accessible and changeable. Some can be 777, more so 755, and most cases 644
Get set the folders to the right permissions the easiest way is to use the Magento cleanup tool here:
http://www.magentocommerce.com/wiki/groups/227/resetting_file_permissions
Scroll down a bit on that page to download the Magento Cleanup Tool
You can also reference the Magento installation cheat sheet Step 2 - Set file permissions:
http://www.magentocommerce.com/knowledge-base/entry/magento-installation-cheat-sheet#step2
So I would set everything back to 644, and then run the cleanup tool.
Magento Permission can be set by running a file in the installation.For that you need to download the magento cleaup tool.
Download Magento Cleanup Tool

Resources