Installing Joomla on Ubuntu (getting ftp write option to work)

Something I ran into when I installed Joomla for the first time on some of my Ubuntu 8.04 (Hardy) environments. The administration setup recommends turning on ftp access for linux environments due to file permission issues while installing extensions. But I ran into JFTP problems when I tried to do that. For initial installation I had chosen to not enable ftp during installation and then I tried to enable it afterwards. I kept getting JFTP error message (see below). At another time I enabled it during the installation. I remember after some retries I was able to do a successful FTP test settings during the install. But still afterwards when I wanted to save changes in the Global settings I got JFTP error messages. My challenge was to figure out what was going on.

My Joomla installation was created under the web root directory owned by another ubuntu user called webuser. The location is ~webuser/www/html. The installation guide recommends enabling global read write permission for the ‘html’ directory and its contents, which kind of made me uneasy. Then I saw others on Joomla forum recommended that setting  permissions of html and other lower level directories to 777 before the install and turning it back to a more restricted 755 afterwards. I did that the installation generally worked.

I had initially disabled the FTP update option. Later on I went into Global Configuration page and wanted to enable the FTP option. Joomla recommends using a ftp account with access limited to the Joomla installation directory instead of the entire web directory. I have a separate ubuntu user account called ftpuser that I wanted to try for this purpose. I am using vsftp as my ftp daemon. First I needed to give read write access to the ftpuser to the Joomla installation directory. So instead of changing the directory permission of ~webuser/www/html to 777 I set it to 775 and made ftpuser a secondary member of the primary group of the webuser user by using usermod. In my case the webuser‘s primary group is webuser that ubuntu assigned by default when I created the user. Same happened for ftpuser who was assigned to a default group called ftpuser by ubuntu.

So that allowed ftpuser to read and write in the html folder via the following link.

/home/ftpuser/html -> /home/webuser/www/html

When I ftp into ftpuser account I can move into joomla directory by simply doing a ‘cd html’.This has been one of the confusing points for me in the ‘FTP Root‘ setting has been one of the confusing thing for me. When I was getting error messages I was not sure if it was because of FTP Root setting or something else. The thing that helped me ensure that my FTP Root was correct was by looking at the /var/log/vsftpd.log file because that clearly showed what file was being accessed. So in Joomla’s global settings page I had specified the following

Host: 127.0.0.1 (default)

Port: 21 (default)

User: ftpuser

Password: *****

Ftp Root: html

I kept getting following FTP errors.

JFTP::write: Bad response

An Error has occurred! Unable to open configuration.php file to write!

My vsftpd logs told me the file path was correct. Then I realized two things.

1. The configuration.php file had a protection of 444 and

2. It was owned by www-data, a user that is created by apache to run the apache web server as.

So after I changed the permission of configuration.php to 664 and giving ftpuser secondary membership in the www-data group, in addition to webuser group, things seem to work. I am not sure if the 444 permission of configuration.php was intended as a part of the installation or something went wrong with umask settings in my apache install.

I guess i could have changed the permission to 666 to make things easier. But did not want to do that.

Advertisements

Leave a comment

Filed under software

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s