Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 14 hours ago.
Improve this question
I've recently converted over to Amazon's Elastic Beanstalk which has been great but I have one problem I haven't been able to fix or find a decent solution to.
When deploying via GIT with
$ git aws.push
My files are deployed but all my folders and files do not have the correct permissions. Currently running Win 8 with xampp for local development. For example on a recent WordPress deployment, all my folders were 777 once deployed to beanstlak. It is an NTFS partition the files are in too.
It is easy enough to SSH in and run:
$ sudo su
$ find /var/www/html/ -type d -exec chmod 755 {} \;
$ find /var/www/html/ -type f -exec chmod 644 {} \;
However I'd rather fix my permissions before upload however I don't think this is possible with Windows. I'm sure I can setup a script or some type of service hook to run these on deployment but I was hoping there may be an easier way.
Any insight from the SO community on setting windows file permissions to match Apache's?
It's actually not that hard to setup a hook to fix the permissions after your code is extracted onto your instance(s) but before it is considered "deployed". You could create a file called .ebextensions/00permissions.conifg, the name isn't important as long as it's in the right folder with the extension .config - the config scripts execute in alphabetical order. The contents would be like:
container_commands:
00fix_permissions_dirs:
command: "find . -type d -exec chmod 755 {} \;"
ignoreErrors: true
01fix_permissions_files:
command: "find . -type f -exec chmod 644 {} \;"
ignoreErrors: true
Note the default directory for a container_command is the directory the deploy files have been extracted to, so no need to set an explicit path.
You can see more info about the kinds of commands you can run on your instances in the Elastic Beanstalk documentation.
container_commands:
00fix_permissions_dirs:
command: "find /var/app/ondeck -type d -exec chmod 755 {} \;"
ignoreErrors: true
01fix_permissions_files:
command: "find /var/app/ondeck -type f -exec chmod 644 {} \;"
ignoreErrors: true
This will change the file permissions of the application. Currently there is no way to run commands when the app is fully deployed, but you can take advantage of the "ondeck" folder which is the folder where beanstalk put your app files before deploying them.
Related
The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.
When trying to update plugins from the admin interface. I’ve set the user to www-data for both directories and files … but nothing works.
What do I have to do to simply being able to use Wordpress as it is intended?
This issue is usually caused by incorrect file permissions or ownerships on your server (rather than being a problem with the plugin itself). Basically, WordPress isn’t able to properly access its own plugins folder, and as a result, can’t put the updated plugins files in there.
Permissions
Permissions can be set to 644 for files and 755 for folders. To do so, you can run two quick find commands.
To make all folders in your website path with 755 permissions run the following command
find /path/to/your_website -type d -exec chmod 755 {} \;
To make all files in your website root directory with 644 permissions, you can run
find /path/to/your_website -type f -exec chmod 644 {} \;
Please make sure to change /path/to/your_website with your real path.
Ownership
Ownership means which user and group are controlling the files. Usually, that’s www-data. So what you’ll need to do si
sudo chown -R www-data:www-data /path/to/your_website
Please make sure to change /path/to/your_website with your real path.
Once you do it, that’s it, you are good to go.
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
Help I got this problem when uploading my first laravel project to cpanel, can anyone help me. I've tried clear cache but it did not work
The error code is:
Illuminate\Foundation\Bootstrap\HandleExceptions::handleError vendor/laravel/framework/src/Illuminate/Filesystem/Filesystem.php:185
and the other error code hinted is:
ErrorException file_put_contents(C:\Users\my_user\Desktop\my_project
name\storage\framework/sessions/DpZjS9gGbWcX1jfqlu4btBLD02ZaRMU58uzgIbgX):
failed to open
public function put($path, $contents, $lock = false)
{
return file_put_contents($path, $contents, $lock =false);
// return file_put_contents($path, $contents, $lock ? LOCK_EX : 0);
}
This sounds like a permission issue with your storage folder. The laravel documentation states:
Directory Permissions
After installing Laravel, you may need to configure some permissions. Directories >within the storage and the bootstrap/cache directories should be writable by your >web server or Laravel will not run.
So try running the following on the server where you uploaded the code:
sudo chmod -R 755 /storage
sudo chmod -R 755 /bootstrap/cache
Since you are running cpanel, instead of running these commands in the terminal, you can use these CPanel Instructions for updating your folder permissions.
I recommend that you reset the whole project folders and files permissions to be suitable with hosting by these two terminal command
sudo find path/to/root -type f -exec chmod 644 {} \;
sudo find path/to/root -type d -exec chmod 755 {} \;
and then
sudo chmod -R 777 storage/
sudo chmod -R 777 bootstrap/cache/
chmod -R gu+w storage/
chmod -R guo+w storage/
also delete the old config.php file
bootstrap/cache/config.php
after the old config.php file deleted
php artisan config:cache
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 2 years ago.
Improve this question
I am running apache2 in Ubuntu 14.04. I have been having trouble with permissions with FTP clients and CMS that use backend FTP. I never seem to be able to get the permissions right. Should www-data be the owner of /var/www/html and root as a user assigned to that group?
Some CMSes and Wordpress is especially bad about that because it's actually in the code to use the web user.
BTW you should never need to use root for ftp. www-data the default apache user on ubuntu should own your web files/directory to work properly with many cmses.
So this is what has worked before and what we did for clients with the same issue. chown the whole web root as www-data for both user and group.
So if your document root is /var/www/html, cd or change directory to /var/www and run this to change ownership on all files and directories.
chown -R www-data: html/
while still in the /var/www directory add write permissions to the group for files and directories by running this command.
find html -type f -exec chmod 664 {} + -o -type d -exec chmod 775 {} +
Finally add your FTP user to the www-data group.
usermod -a -G www-data username
Replace usename with your FTP client username
Now this setup should allow you to use manage files and still allow the CMS ftp backend to still function and write to the direc. Let me know how that works for you.
This command worked for me:
sudo chown $(whoami) your_folder_name
I'm trying to make some sort of cloud application on a headless raspbian machine.
The testing happens on a wamp-server running on windows8.1. PHP version is 5.6
The code works fine on my testing windows, but I run into issues when running the same code on my linux server. I've narrowed down the issue to the fact that (the linux user behind) my PHP code doesn't have write permissions on the folder where it should store files.
I can think of two ways to solve the issue: either give that php-user permissions, or change the user behind the php code. The last one would be quite interesting if it was possible to change per-script.
So, for my concrete question:
1) Where can I find what user is being used by my PHP code?
2) Can I change what user my PHP code uses, preferably on a per-project basis?
EDIT:
My script was running as root, as is shown by echo get_current_user();. I changed ownership of all files to root:webhosting, which was previously ftpuser:ftpgroup. However, when setting permissions to 770 I get access denied
EDIT2:
When using var_dump(posix_geteuid()); instead of get_current_user();, i get UID 33, which matches user www-data.
SOLUTION:
By looking at the EUID with var_dump(posix_geteuid(); I was able to validate the actual user, which does NOT match the get_current_user();. Changing the directroy and all files in it with sudo chown -R www-data:www-data <root of site> I managed to set the correct permissions.
I am not sure what the specifics are but normally when I have issues like that I change the ownership to www-data:www-data and if necessary for upload folders I change the folder permissions to 0755 and inside files permissions to 0644.
EDIT
I changed the permissions setting for security purposes.
You're PHP/Apache user is probably www-data. You probably want to run something like this.
sudo find path/to/project/ -exec chown www-data:root {} \;
File permissions may also be a problem. If so, run something like this.
sudo find path/to/project/ -type d -exec chmod 775 {} \;
sudo find path/to/project/ -type f -exec chmod 664 {} \;
I've got the following problem with laravel (5.1) sessions on ubuntu 14.04. On every request a new session file in storage/framework/sessions is generated. As you have already guessed, the session driver is 'file', 'lifetime' is set to 120. This seems to be some sort of permission error. I've set the permission of the storage folder to 755 (also 777), but every newly generated session file has the permission 664 (rw- rw- r--). Via google I've only found a session issue related to dd(...), but this is not the case here, especially that it works fine on a windows environment.
What I originally wanted to do is use the redirect()->intended(), which uses the information stored in the session.
Do I have to run php artisan serve in a special way?
Since I use Vagrant and Homestead everything is fine. Running the PHP built in webserver seems the be a kludge only.
Test the funcionality giving all the permissions to the storage folder
find /path/to/storage/folder -type d -exec chmod 777 {} \;
If it works then set the propper permissions that in most of the cases should be
find /path/to/storage/folder -type d -exec chmod 775 {} \;
That way you only change the permissions to the directories not the files.
If the problem it's the newly created are being set with different owner you could set the permission for it.
It's like when I'm developing on my local server I have my user and the www-data user it's the one for Apache, so if apache creates a new file the ownership starts to mess up.
find /path/to/root/of/project -type d -exec chmod g+s {} \;