403 forbidden error after Update with Drush

May 15th, 2011 admin Location: Raleigh, NC, Topic: Web Design | Digital Media

Problem

Ok, so if you decide to use Drush (4) and decide to upgrade your installation of Drupal (6.2x) then perhaps you’ll experience a little problem. This problem has happened to me quite a few times now and that is why I am writing this post. I don’t want this to happen either to me or to anybody in the future. If it happens, then here are the instructions on how to fix it.
Let’s start by saying what doesn’t work:
1. My first thought was to check for the error log to see if it gave me better clues at what was happening with the Drupal site after the drush update command (drush up). Now, before we continue, remember that before you hit ENTER on that command, make a copy of your htaccess file and of your robots.txt. Believe me, this will make it easier on you.

2. I checked the error log and it basically told me the following:
“[Date [crit] [client 200.111.222.111(ip address)] (13)Permission denied: /home/user/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable”.

3. I thought then that it had to do with the permissions of the htaccess file (chmod). However that is not what causes the problem.
4. When I tried that it didn’t work.
5. Then I changed the ownership of the files recursively on the entire root and sure enough it didn’t work either. Simply because the problem happens because the public_html folder alone has to have the group ownership set to “nobody”. Can you believe that? How do you do that? With the command “chown” (Change Ownership) the first parameter is the username, the second one is the group. So for example if you say chown alex:nobody myfolder/ , then you are assigning the ownership of myfolder/ to user alex and group “nobody”.

Why does it happen in the first place?

First the problem happens because you are logged it with a different user with SSH into your server. That alone is going to make the Drush calls from that user. So if you call the drush commands without changing your user, of course you are going to end you changing your ownership of the files.

Merkados’ Recommended Solution

So here are the changes that need to happen:

/*Comment of Code*/
#chown -R ftp_username:ftp_username path_to_drupal_home_folder
#chown ftp_username:nobody path_to_drupal_home_folder
/*End of Code*/

Notes:

1. The chown command is used to change the ownership of the files. In the first line you are changing ownership recursively of all the drupal files and assigning it to the user with ftp access and group with the same name.

2. The second line makes the change to the home folder. Please note that the group is set to “nobody” and please also note that it is not recursive so don’t use the -R!

That’s it. If you follow this instructions you will be avoiding those 403 forbidden notices and doing more work. Don’t worry about the fact that the error logs instruct you about lack of read-access to .htaccess. Obviously this problem is generated by the ownership problem described here. Once you fix the problem with the ownership, then you won’t have the error with your htaccess file.

Please don’t hesitate to contact Merkados for your strategic interactive media needs.

About the Author

Alex Centeno MBA., is an international creative director and digital media strategist. Currently residing minutes away from the Research Triangle Park (RTP) - North Carolina, and with over 10 years of interactive marketing training and experience, Alex leads Merkados' international clients to maximizing their online business strategies. One of Alex's biggest strengths is his world-class capacity to effectively combine interactive marketing, digital media design and web development.

You may find further information about Alex Centeno MBA. at: and Twitter.

Sobre el Autor

Alex Centeno MBA., Es un director creativo y estratega de medios digitales reconocido internacionalmente. En la actualidad reside a tan solo minutos del Research Triangle Park (RTP) - Carolina del Norte, y con más de 10 años de entrenamiento y experiencia en marketing interactivo, Alex lidera a los clientes internacionales de Merkados™ para maximizar sus estrategias de negocios en línea. Una de las mayores fortalezas de Alex es su capacidad global de combinar de manera efectiva, mercadeo interactivo, diseño de medios digitales y desarrollo web.

Para más información sobre Alex Centeno MBA. puede visitar: y Twitter.