File system permission error while installing drupal modules - drupal

When I try to install new modules to drupal 7 via "Install new module" form, I get following error message.
The specified file
temporary://fileTFJ015 could not be
copied, because the destination
directory is not properly configured.
This may be caused by a problem with
file or directory permissions. More
information is available in the
system log.
http://ftp.drupal.org/files/projects/date-7.x-1.0-alpha2.tar.gz
could not be saved to
temporary://update-cache/date-7.x-1.0-alpha2.tar.gz.
Unable to retrieve Drupal project
from
http://ftp.drupal.org/files/projects/date-7.x-1.0-alpha2.tar.gz.
My Drupal 7 is installed with CPanel QuickInstall tool and hosted with HostGator shared hosting service.
Any ideas how to solve this issue?

There is an issue with shared hosts and temp folders...if you want the background you can read this:
http://drupal.org/node/1008328
in the meantime try changing your tmp folder to be relative to your sites file root:
sites/default/files/temp

The quickest way to get a handle on this issue is to navigate via your web browser to:
/admin/config/media/file-system
You'll probably see an error there about not being able to write to the /tmp directory. To fix this, you can create a temp directory under site's root and set permissions appropriately.
1) Create a directory here [drupal_installed_here]/tmp
2) Navigate via your web browser to /admin/config/media/file-system and change the temp directory to be:
tmp instead of /tmp (no leading slash)
3) Try this command:
chmod 775 [drupal_istalled_here]/tmp
and refresh the /admin/config/media/file-system page
3) If that does not work, try this command:
chmod 777 /home/quickstart/websites/tmp
and refresh the /admin/config/media/file-system page
The last command opens up your temp directory permissions a lot (rwxrwxrwx), but sometimes that's necessary to get your site working on shared hosts.

This error took me a long time to figure out despite several threads on the internet related to it.
If you get this error on a page, then here are the steps that you need to follow to solve it:
Go to Admin->Reports->Recent Log Messages. Read the most recent error message. This will tell you which folder is causing the problem. It is not necessarily the directory listed in the online threads about this subject. For me it was: sites/default/files/js
If you are running Drupal on a linux server then you need to add read/write permissions to the problem folder. You can do this by going to the linux/SSH command line and typing the following (replace the folder address with the address for your folder)
chmod 777 /var/www/html/sites/default/files/js
That's it. The error message should be gone now.

My old, problematic configuration:
chmod 664 -R /var/drupal-bc/sites/default/files
chmod 664 -R /var/drupal-bc/sites/default/private
drw-rw-r-- 2 www-data www-data 4096 Jul 31 12:35 files
drw-rw-r-- 3 www-data www-data 4096 Jul 5 15:08 private
My new, functional configuration:
chmod 774 -R /var/drupal-bc/sites/default/files
chmod 774 -R /var/drupal-bc/sites/default/private
drwxrwxr-- 2 www-data www-data 4096 Jul 31 12:35 files
drwxrwxr-- 3 www-data www-data 4096 Jul 5 15:08 private

Please do not use 777 permissions, because you will have security problems. 775 will do just fine.
chmod 775 -R /var/drupal-bc/sites/default/files
chmod 775 -R /var/drupal-bc/sites/default/private
If you have javascript caching turned on, you might need to 755 the /sites/all/your-theme/js

chmod 777 /var/www/html/sites/default/files/js
solved the issue for me

Related

Duplicator folder permissions Linux

I am trying to migrate a WordPress site using the Duplicator plugin. I have created an ec2 instance on AWS, installed Apache and copied over the files from the Duplicator backup to /var/www/html/.
When I visit the site on the browser going to myip/dup-installer/main.installer.php I get the following error:
My www folder permissions are : drwxrwxrwx 3 root www-data 4096.
My html folder permissions are: drwxrwxrwx 7 www-data www-data 4096.
My dup-installer folder permissions are: drwxrwxrwx 8 www-data www-data 4096.
And finally, my main.installer.php file permissions are: -rw-rw-r-- 1 www-data www-data 20437.
It all looks correct but I don't understand why I'm getting the error when I visit the installer. Is there something wrong with my permissions?
Currently, your permissions are fully open on your www directory. That shouldn't be like that, most files should not be world writable.
you should change this to 755 via this command:
sudo chmod -R 755 /var/www
Note, use the correct path to your www directory if it isn't correct for you.
regarding your missing CSRF (Cross-Site Request Forgery) file, this is probably because your copy didn't have the correct priv to copy it. Might look on the original server to see if you can grab it and move it over.
It turns out I had to execute [website-hush-information]_installer-backup.php which sits one level before the dup-installer folder.
I was trying to execute the main.installer.php inside dup-installer based on previous experience with this plugin, but in this version, this was not needed.
Thanks for the help #JP-LISN, it pointed me in to the correct direction by the process of elimination.

Nginx serving file error 403 forbidden

To give first some history to this problem; I'm setting up a django site on digitalocean first copied using root and the django folder had as the owner root and I've since worked on fixing this and now the site it up and running but one image still has the 403 forbidden error.
I'm looking for a command that can change the rights of this file.
-rwxr----- 1 sammy sammy 566719 Jul 1 14:52 developer.jpg
Your NGINX user is likely using the www-data or a different user, to verify the user being used by NGINX in a shell execute:
grep user /etc/nginx/nginx.conf
Then to change the file permissions:
chown www-data:www-data developer.jpg
Looking at your file permissions they also needed adjusted - see this answer for recommended perms.
(may require sudo, replace www-data with your NGINX user)
chmod -R 777 folder_name
chmod -R 777 file.name //when You are in directory where this file exist
or
chmod -R 777 file_path/file.name

Permission Denied error setting 777 folder access

I created a user with admin access named hadoop. The funny thing is that when I create a folder and try to give it 777 access it gives me back an error.
hadoop#linux:~$ mkdir testfolder
hadoop#linux:~$ ls -ltra testfolder/
total 8
drwxrwxrwx 25 hadoop sudo 4096 Jun 14 20:00 ..
drwxrwxr-x 2 hadoop hadoop 4096 Jun 14 20:00 .
hadoop#linux:~$ chmod -777 -R
testfolder/ chmod: cannot read directory ‘testfolder/’: Permission denied
Why is that when I am the creator of the directory ?
hadoop#linux:~$ groups
hadoop root sudo
Strangely, using the GUI, I can go in and right click the directory and change the file permissions. Can anyone help me understand what i am not understanding.
Note : I use Ubuntu 14
Your command chmod -777 -R testfolder/ is the issue here, more specific the - as part of the first argument.
Leave it away, just use chmod 777 -R testfolder/ and all should be fine...
Not exactly sure about the details, but the -777 should remove permissions, thus preventing access at least to the recursive portion of the command. I assume that is not what you want to do. Instead you probably want to grant more permissions to the directory. Looks like the command blocks itself. Though that might be by purpose, at least in an indirect manner.

File permission set to 755 but still no web access

I've ran into a problem after setting a folder and its contents to 755 permissions.
I ran
chmod 755 -R folder/
However, when trying to access in my /var/www folder via the browser I get a 403 Forbidden error.
I did download the folder from the web, but other files with 755 permissions are loaded just fine into the browser. Here is what it looks like:
ls -l
drwxr-xr-x. 4 root root 4096 folder
Edit: If you're going to down vote, how about explain why?
drwxr-xr-x.
The trailing dot means the directory has an SElinux ACL, which is likely the cause of your problem. -- the ACL denies access.

Upload file wordpress

I am trying to upload a file in wordpress using the Media > Add New -- Option but when I click upload I get the following error:
Unable to create directory wp-content/uploads/2012/11. Is its parent
directory writable by the server?
I have Wordpress 4.3.1 installed.
Thank you
EDIT:
I am on a shared server with: host=i686-redhat-linux-gnu and Apache. I changed the permissions to 755 and 777 of wp-content/uploads but I get the following error:
“my_file.jpg” has failed to upload due to an error Unable to create
directory wp-content/uploads/2012/11. Is its parent directory writable
by the server?
Any ideas?
You need to set folder permissions for /uploads/ and possibly for /wp-content/ , too.
Typically, both folders should be 755. You may have to temporarily raise /uploads/ to 777 and upload an image (this will also force the server to change the folder permissions and user to the correct settings), but change it back to 755 right away.
It's easiest to set permissions with an FTP client. See Filezilla and FTP Clients « WordPress Codex.
And see Changing File Permissions « WordPress Codex for the correct Wordpress permission settings:
From the codex.wordpress: Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared
hosts, files should never be owned by the webserver process itself
(sometimes this is www, or apache, or nobody user).
Any file that needs write access from WordPress should be owned or
group-owned by the user account used by the WordPress (which may be
different than the server account). For example, you may have a user
account that lets you FTP files back and forth to your server, but
your server itself may run using a separate user, in a separate
user group, such as dhapache or nobody. If WordPress is running as the
FTP account, that account needs to have write access, i.e., be the
owner of the files, or belong to a group that has write access. In the
latter case, that would mean permissions are set more permissively
than default (for example, 775 rather than 755 for folders, and 664
instead of 644).
ssh in and navigate to the wp-content folder and type in these 2 lines:
sudo chown -R www-data uploads/
sudo chmod -R 755 uploads/
or you can use the static and full path:
sudo chown -R www-data /var/www/wp-content/uploads/
sudo chmod -R 755 /var/www/wp-content/uploads/
Do not change it to permissions 777 because that is simply insecure
I had the same problems last week. After trying all proposed solutions with no success, it occurred to me that we had SElinux enabled on the server. In my case, and maybe for many other people, SElinux was responsible of the error message:
Unable to create directory wp-content/uploads/2013/04. Is its parent directory writable by the server?
My solution is based on the one proposed here: http://doc-ok.org/?tag=selinux which could be more suitable to other people's needs.
In my case, my wordpress directory resides in my home folder on the server, to which I have ssh access. Otherwise you will have to ask your administrator.
Anyway, this is my solution.
chgrp -R apache wordpress #change wordpress with your base directory for wp..
#alternatively, chown the whole directory to apache
chmod -R 774 wordpress/wp-content #if chown by apache, the permissions can be more restrictive
In my case not only the folder ownership / group ownership had to be changed to apache. Also the SElinux label of wp-content directory had to be changed to either httpd_sys_rw_content_t or httpd_sys_content_t:
chcon -Rv --type=httpd_sys_content_t wordpress/wp-content
This did the trick for me.
More information on SElinux can be found for example at:
wiki.centos.org/HowTos/SELinux
and
fedoraproject.org/wiki/SELinux
The /wp-content/uploads directory needs to be writeable by your webserver. Assuming that you are using Apache on Linux, and that it is running as user apache (change to your appropriate user) one quick fix for this would be to run the following command from your web root.
chown -R apache.apache wp-content/uploads
chmod -R 755 wp-content/uploads
I faced the same issue and I found a better solution:
go to cpanel > phpmyadmin
select database
open wp_options table
make sql query SELECT * FROM wp_options WHERE option_name LIKE '%upload_path%'
change the path
this should fix it.
sudo chown -R www-data:www-data wp-content/uploads
Do not change the permissions to 755 if it's not necessary.
If it still doesn't work try:
chmod -R 755 wp-content/uploads
this works for me, after many weeks headache
sudo chown -R apache uploads
sudo chmod -R 755 uploads
assuming you're in wp-content
for those who stumbled on selinux permission issue, here are the steps i made to fix them. We need to allow the following selinux boolean variables to allow installing of wordpress plugins from wordpress admin console using FTP. They are httpd_can_network_connect and ftpd_full_access. They can be activated by
setsebool ftpd_full_access on
setsebool httpd_can_network_connect on
also wp-content folder should be write permissible for the ftp user used for uploading.

Resources