'Unable to connect to the filesystem. Please confirm your credentials

I tried to install Elementor plugin for wordpress on Mac in localhost, but the installation has failed. These are the details:

Hostname: /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/plugins

Ftp Username: root

Password:

With password I got this error alert:

Failed to connect to FTP Server /Applications/XAMPP/xamppfiles/htdocs/wordpress/wp-content/plugins:21

With no password I got this error alert:

Unable to connect to the filesystem. Please confirm your credentials.

I search for similar cases and found that I have to add this line to the code:

define('FS_METHOD','direct’);

and then I got this message:

Installation failed. could not create directory.

I’m not familiar with code writing, and I’m new to Wordpress, I would greatly appreciate your help.

Regards



Solution 1:[1]

try this command as it will not expose your entire html to hackers and this works in my case

sudo chown -R www-data:www-data /var/www/html/your-project-name

Solution 2:[2]

It's probably due to lack of required filesystem permissions. Try this:

sudo chown -R www-data:www-data /var/www

Solution 3:[3]

I also had this issue. Solution is go to applications/xampp/htdocs and right click on the wordpress folder on which you are trying to install plug-in or theme. click get info, scroll to bottom, click on the lock to unlock it and type in your password and enter, in sharing and permissions allow privilege to system,admin and everyone and click on the setting icon in bottom left and apply to enclosed items.

Solution 4:[4]

Macbook Solution:

Step 1:

edit /Applications/XAMPP/xamppfiles/etc/httpd.conf and replace

User daemon
Group daemon

to

User YOUR_MACBOOK_USER_NAME   // apple
Group GROUP_NAME              // admin

after Step 1, you need to restart xampp, if you do not get your problem solve than follow Step 2

Step 2:

run this command

sudo chown -R YOUR_MACBOOK_USER_NAME:GROUP_NAME /Applications/XAMPP/xamppfiles

// like this

sudo chown -R apple:admin /Applications/XAMPP/xamppfiles

OR

sudo chmod -R 777 /Applications/XAMPP

Ubuntu Solution:

run this command on terminal

sudo chown -R www-data:www-data /var/www

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 khan Farman
Solution 2 eaorak
Solution 3 Padqi
Solution 4