How to Setup FTP to use in locally hosted wordpress
Solution 1
Well your Wordpress login and your FTP login are two different things. I have see that you use vsFTPd, so one easy thing that you can do it this :
Edit the vsFTPd configuration file :
gksu gedit /etc/vsftpd.conf
Add this at the end :
local_enable=YES
Restart your vsFTPd server :
sudo /etc/init.d/vsftpd restart
Now you should be able to connect to your FTP using your Ubuntu login.
Solution 2
For me changing the ownership of the wordpress folder solved the issue.
sudo chown -R www-data wordpress
Solution 3
Just add this line to wp-config.php
define('FS_METHOD', 'direct');
Then It will be OK.
Solution 4
I had the same issue.
When I created my Ubuntu server I installed a wordpress site and everytime I wanted to update a plugin I needed ftp access which was really annoying. I knew I could just add the ftp details in the config for wordpress but I was Like NAH! So It turned out that wordpress can't write files to the wp-content directory because apache doesn't have permission to edit the directory so this is how I fixed it.
Copy group file to groups in the same directory
sudo cp /etc/group /etc/groups
Then give Recursive Permission to apache
sudo chown -R www-data:root /var/www
Thats it.
Another way of doing it is by editing apache envvars
sudo nano /etc/apache2/envvars
Edit the lines where it says
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
And replace www-data with your username for ubuntu
export APACHE_RUN_USER=USERNAME
export APACHE_RUN_GROUP=USERNAME
now restart apache
sudo service apache2 restart
and then make sure your account has permissions to the directory
sudo chown -R USERNAME:USERNAME /var/www
If this doesnt work for you then simply reply.
Solution 5
If you are using the default file the problem I had was not seeing enable write access. That resolved my problems.
listen=YES
local_enable=YES
write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
Related videos on Youtube
Gaurav Butola
Updated on September 17, 2022Comments
-
Gaurav Butola over 1 year
I have installed wordpress on my ubuntu 10.10 desktop edition and I am trying to install plugin from the browser (I know I can drop it to the wp-content/plugin but I want to do it via the web browser using FTP) I get this screen when I am trying to set auto update or install a plugin from web browser.
I provide the hostname 127.0.0.1 and Username and password the ones that I use to login to wordpress. I get the error
Username/password Incorrect and cannot connect to 127.0.0.1:20
I think i'll have to grant a user with ftp password but I dont know how. I have already installed vsftp but when I try "ftp 127.0.0.1" I get -
$ ftp 127.0.0.1 Connected to 127.0.0.1. 220 (vsFTPd 2.3.0) Name (127.0.0.1:gaurav): root 331 Please specify the password. Password: 530 Login incorrect. Login failed. ftp>
Wordpress is running locally on my Ubuntu Desktop.
-
Gaurav Butola over 13 yearsand how can I grant a user (wordpress user) access to FTP who can use FTP over the network
-
Tomasz Kalkosiński over 13 yearsI would also not login as root, but create a dummy user, make him part of your www-data group and use it to push updates/install
-
Liz over 13 yearsI had this same issue and just wanted to add for any others that are going through this that you need to use '127.0.0.1' and not 'localhost'. Or at least I did. Also had to use FTP not FTPS.
-
Jakke almost 10 yearsThe same issue here, write_enable is commented out by default. Thanks for the tip. It's nowhere mentioned here, but I also changed the home directory for the wordpress ftp user to /var/www/html (or whatever the path to the site is). I'm not sure if this is actually needed.
-
Jakke almost 10 years-1 Even though it's listed as best answer, it lacks the information that write_enable is commented out by default. If you do not uncomment, your solution still doesn't work.
-
jdow over 8 years+1 for
sudo service vsftpd ....
-
JoniVR almost 5 yearsAre there any disadvantages with this method? Seems like the best/easiest one to me but I could be wrong.
-
Max Kulik over 4 yearsThis worked right away for me!
-
ifrit about 4 yearsIt doesn't help here :/