Posts tagged apache2
How to give ftp users access to directories outside their home folder in linux
Jun 24th
Situation
You are using a webserver like apache2 or lighttpd to host websites under the /var/www directory, and letting your linux users upload and edit the files in their home folder via ftp.
Each user use their own domain, and maybe you have set up virtualhosts in apache2.
That is a convenient way to host multiple sites for multiple people, but, you may have a problem if you are using the traditional symlink between the two folders; users home directory, and the webservers default root directory.
Say you have 2 users, with 2 different websites:
User Jen:
- Home folder: /home/Jen
- Documentroot, virtualhost: /var/www/jen.com
User Alex:
- Home folder: /home/Alex
- Documentroot, virtualhost: /var/www/alex.com
And you are using vsftpd, with the setting chroot_local_user=YES so that users are limited to their own home folder.
How to make WordPress work under linux (solve the FTP login request)
Jun 24th
Problem
WordPress cannot install, delete or update plugins or themes. WordPress asks you for your FTP server login credentials.
The reason for this, may be that wordpress checks if the userid it is running under, is the same as the owner of the file or folder it tries to edit.
The problem seems to be located at line 876 in the method get_filesystem_method in wordpress/wp-admin/includes/file.php:
if ( getmyuid() == @fileowner($temp_file_name) ) $method = 'direct'; @fclose($temp_handle); @unlink($temp_file_name);
This means, when wordpress is running, its userid is www-data (apache2), but the file owner may be Chris, so it gives an error.
You want to own your websites files, you don’t want to change the owner to www-data (apache2) although that would work:
(you can do that by executing chown www-data:www-data * -R when you are in the wordpress directory. and then add yourself to www-data group by executing: usermod -a -G www-data Chris )
