Question
Wordpress asking for FTP Credentials
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×This is user’s permission problem that will be solved by method given below that worked for me.
step-1 : First open wp-config.php file of your wordpress installation folder.
step-2: Copy below code and paste it at the end of the wp-config.php file.
define('FS_METHOD','direct');
step-3: Now open your droplet access console and enter root as username and its password.
step-4: Copy below code and paste it into access console where you have to specify your plugin directory path and then hit enter.
chmod 777 /yourwebsitename/public/wp-content/plugins/
Note: Replace your website name in the place of yourwebsitename.
Thank you.
That is what I did, and it worked.
Only I used 755 instead of 777, as that seems a bit safer…
i did that and wp “Installation failed: Could not create directory. ”
sudo chown username:www-data /var/www -R
sudo chmod g+w /var/www -R
After you upload your files, you’ll want to make sure ownership permissions are set to Apache so that Wordrpess can update and/or install plugins without requiring FTP credentials. You can set permissions via SSH.
Single site hosting:
chown -R apache:apache /var/www/html
Multi site hosting:
chown -R apache:apache /var/www/
You may need to do this whenever uploading folders.
Thanks! This worked on Ubuntu 16.04, using www-data:www-data instead of apache:apache, which came up as invalid user. Updated without asking for FTP credentials. Nice!
use this code , wordpress asking for ftp details because wordpress doesn’t have permission to write in your server.
use these two commands in terminal.
$sudo a2enmod rewrite
$sudo chown -R www-data /var/www
video guide [https://www.youtube.com/watch?v=RGGWVUIvhnk](http://)
After changing the permissions, try adding this to your wp-config.php to include this line:
define(‘FS_METHOD’, 'direct’);
That worked for me.
you can login width root and Type the command: “`
If you log in as root you do not need to type “sudo” as you will be root. I highly suggest not logging in as root to do this. The point of typing in “sudo” is to request root permissions for that 1 command..
If this is your test rig or going to use it only as a local host you can change the user and group configuration to your user then you do not need the define('FS_METHOD', 'direct');
code to be added in the wp-config.php file.
use the following command to open the apache2 envars file
sudo nano /etc/apache2/envar
Once the environment variable file is opened scroll to section where you will find
export APACHERUNUSER=www-data
export APACHERUNGROUP=www-data
replace the “www-data” with your user name example “user”.
This should fix most of the problems for you
With this you have added the user as Apache2 owner so setting default chmod to 755 or 750 for directories and 644 for files should work without any error.
I am using a similar hosting site; I purchased their Ubuntu 16.04 VPS 12 dollars a month for 1 GB of RAM and 25 GB of storage. I used shell access and a tutorial on how to install the LAMP stack, and install WordPress using the chown and chmod commands. I assigned the user wordpressuer with sudo priveleges, and I created an SQl database with the same user using PHP My Admin. All was going well and smoothly, up until I got to the point where I needed to update WordPress and or install additional plugins. I tried using WinSCP to set every single file with 7777 permissions, but it still keeps asking me for FTP credentials, and I haven’t found any tutorials on how to set up an FTP server on Ubuntu 16.04 that could solve this problem until I can figure out why I keep getting this error. My WordPress and other stuff is in /var/www/html. I have it set up so that my WordPress is installed in a directory called /blog, and my podcast generator in /podcasts.
Also, there is a popular CMS called Podcast Generator which I mentioned above. Before installing, it runs some scripts to determine if it has the needed writing and execution permissions in the following directories. If there are problems, it will tell you so you can change the writing permissions to 7777. I think WordPress needs to have something similar so it can be made easier to troubleshoot errors like these.