How to Install WordPress Themes and Plugins Without FTP (Amazon Linux 2023)
WordPress asks for FTP details when PHP cannot write to its own files, because the files belong to a different user than the one PHP-FPM runs as. On Amazon Linux 2023, PHP-FPM runs as apache by default (check /etc/php-fpm.d/www.conf), so run sudo chown -R apache:apache /var/www/wordpress, set folders to 755 and files to 644, and restart PHP-FPM; themes and plugins then install directly from the dashboard. define('FS_METHOD','direct'); and WP-CLI are optional helpers. Never use chmod 777.
Come on, friends! WordPress is installed, now you want to add a theme – you click Install Now and WordPress asks "FTP hostname, FTP username, password". Here many students start installing vsftpd or run chmod 777. Both are wrong. What is the problem? The owner of the files is wrong. Today we fix that – without FTP, the safe way.
चला मित्रांनो! WordPress इन्स्टॉल झालं, आता थीम टाकायची – Install Now दाबलं आणि WordPress विचारतंय "FTP hostname, FTP username, password". खूप स्टुडंट्स इथे vsftpd इन्स्टॉल करायला बसतात किंवा chmod 777 करतात. दोन्ही चूक. प्रॉब्लेम क्या है? फाइल्सचा मालक (owner) चुकीचा आहे. आज ते बरोबर करूया – FTP शिवाय, सुरक्षित पद्धतीने.
चलो दोस्तों! WordPress इंस्टॉल हो गया, अब थीम डालनी है – Install Now दबाया और WordPress पूछ रहा है "FTP hostname, FTP username, password". बहुत स्टूडेंट्स यहाँ vsftpd इंस्टॉल करने बैठ जाते हैं या chmod 777 कर देते हैं. दोनों ग़लत. प्रॉब्लम क्या है? फ़ाइलों का मालिक (owner) ग़लत है. आज उसे ठीक करेंगे – बिना FTP के, सुरक्षित तरीक़े से.
Quick answer
On Amazon Linux 2023 with WordPress in /var/www/wordpress:
grep -E '^(user|group)' /etc/php-fpm.d/www.conf # user = apache, group = apache (default)
sudo chown -R apache:apache /var/www/wordpress
sudo find /var/www/wordpress -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress -type f -exec chmod 644 {} \;
sudo chmod 640 /var/www/wordpress/wp-config.php
sudo service php-fpm restart
Then Plugins → Add New → Install Now works without asking for FTP.
What do I need before fixing this?
- WordPress installed on Amazon Linux 2023 — see How to Install WordPress on AWS EC2. The path below is
/var/www/wordpress; use yours if it is different (for example/var/www/html). - SSH access with
sudo: How to SSH into EC2 from Windows, Mac and Linux. - It works the same with Apache or Nginx in front, because PHP-FPM is the process that writes the files.
Why does WordPress ask for FTP details?
You click Install in the WordPress dashboard. PHP-FPM (user apache) tries to write into wp-content. When the files belong to that same user, the plugin installs directly; when they belong to someone else, WordPress asks for FTP details.
तुम्ही WordPress डॅशबोर्ड मध्ये Install क्लिक करता. PHP-FPM (यूजर apache) wp-content मध्ये लिहायचा प्रयत्न करतो. फाइल्स त्याच यूजरच्या असतील तर प्लगिन डायरेक्ट इन्स्टॉल होतो; दुसऱ्या कोणाच्या असतील तर WordPress FTP डिटेल्स विचारतो.
आप WordPress डैशबोर्ड में Install क्लिक करते हो. PHP-FPM (यूज़र apache) wp-content में लिखने की कोशिश करता है. फ़ाइलें उसी यूज़र की हों तो प्लगइन डायरेक्ट इंस्टॉल होता है; किसी और की हों तो WordPress FTP डिटेल्स पूछता है.
Before installing anything, WordPress creates a small test file in wp-content and compares its owner with the owner of WordPress's own files. If they match, it uses the direct method and writes the plugin itself. If they do not match — for example the files were copied as ec2-user or root while PHP-FPM runs as apache — WordPress assumes it may not write there and falls back to FTP or SSH, which is why the "Connection Information" form appears.
How do I install themes and plugins without FTP?
Step 1 — Find the user PHP-FPM runs as
grep -E '^(user|group)' /etc/php-fpm.d/www.conf
ps -o user= -C php-fpm | sort | uniq -c
On Amazon Linux 2023 you normally see user = apache and group = apache — also when Nginx is the web server, because the Nginx PHP config on Amazon Linux 2023 only connects to this PHP-FPM pool through its socket. The master process shows as root; the workers that run WordPress show as apache. If your file says another user, use that name in the next steps.
Step 2 — Give the WordPress files to that user
ls -l /var/www/wordpress | head -5 # who owns the files now?
sudo chown -R apache:apache /var/www/wordpress
ls -ld /var/www/wordpress/wp-content # owner and group should now be apache
Ravindra Bagale's Tip
Because the theme won't install, many students run chmod -R 777 – it works, but now any user on the server, or one hacked plugin, can change your whole site. Never do this. The problem is not the permissions, it is the owner. Make the PHP-FPM user the owner (apache), folders 755, files 644. 777 means leaving every door of the house open. Keep this in mind!
Ravindra Bagale's Tip – मराठी
थीम इन्स्टॉल होत नाही म्हणून खूप स्टुडंट्स chmod -R 777 करतात – काम होतं, पण आता सर्व्हर वरचा कोणी पण यूजर किंवा हॅक झालेला एक प्लगिन तुमची पूर्ण साइट बदलू शकतो. हे कधीच करू नका. प्रॉब्लेम permission चा नाही, owner चा आहे. Owner PHP-FPM चा यूजर करा (apache), फोल्डर्स 755, फाइल्स 644. 777 म्हणजे घराचे सगळे दरवाजे उघडे ठेवणं. ध्यान रखो!
Ravindra Bagale's Tip – हिंदी
थीम इंस्टॉल नहीं हो रही इसलिए बहुत स्टूडेंट्स chmod -R 777 कर देते हैं – काम हो जाता है, पर अब सर्वर का कोई भी यूज़र या हैक हुआ एक प्लगइन आपकी पूरी साइट बदल सकता है. यह कभी मत करो. प्रॉब्लम permission का नहीं, owner का है. Owner PHP-FPM का यूज़र बनाओ (apache), फ़ोल्डर्स 755, फ़ाइलें 644. 777 मतलब घर के सारे दरवाज़े खुले छोड़ देना. ध्यान रखो!
Step 3 — Set safe permissions (755 / 644)
sudo find /var/www/wordpress -type d -exec chmod 755 {} \;
sudo find /var/www/wordpress -type f -exec chmod 644 {} \;
sudo chmod 640 /var/www/wordpress/wp-config.php # database password: owner and group only
755 folders and 644 files let the owner (apache) write, and everybody else only read. That is all WordPress needs.
Step 4 — Restart PHP-FPM and install from the dashboard
sudo service php-fpm restart
Log in to /wp-admin → Appearance → Themes → Add New Theme, or Plugins → Add New Plugin → Install Now → Activate. No FTP form this time. 🎉 Uploading a .zip theme (Upload Theme) and WordPress core updates also work now.
Step 5 — Optional: FS_METHOD direct
If the form still appears after fixing the owner (for example with an unusual setup), you can tell WordPress to always write directly. Open wp-config.php:
sudo nano /var/www/wordpress/wp-config.php
Add this line above /* That's all, stop editing! Happy publishing. */:
define('FS_METHOD', 'direct');
Save (Ctrl+O, Enter) and exit (Ctrl+X). FS_METHOD only changes how WordPress writes. If PHP-FPM still cannot write to the folders, installs fail with "Could not create directory" — so the ownership fix in Step 2 is always the real solution.
Step 6 — Optional: WP-CLI, without the dashboard
WP-CLI installs themes and plugins from the terminal. Install it once:
curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
php wp-cli.phar --info
chmod +x wp-cli.phar
sudo mv wp-cli.phar /usr/local/bin/wp
Run it as the PHP-FPM user, so the new files get the right owner (with the full path, because sudo does not search /usr/local/bin on Amazon Linux 2023):
sudo -u apache /usr/local/bin/wp plugin install classic-editor --activate --path=/var/www/wordpress
sudo -u apache /usr/local/bin/wp theme install astra --activate --path=/var/www/wordpress
sudo -u apache /usr/local/bin/wp plugin list --path=/var/www/wordpress
A warning about the WP-CLI cache folder is harmless. Do not run wp as root or with plain sudo: the files would belong to root and the FTP form would come back.
Ravindra Bagale's Tip
Pay attention: after fixing the owner, if you add new files with sudo cp or sudo unzip, they belong to root – and the FTP form comes back. When you have finished adding files, run sudo chown -R apache:apache /var/www/wordpress once more. Got it? One owner, permissions 755/644 – that's it.
Ravindra Bagale's Tip – मराठी
लक्ष द्या: owner फिक्स केल्यावर तुम्ही sudo cp किंवा sudo unzip ने नवीन फाइल्स टाकल्या, तर त्या root च्या नावावर जातात – आणि FTP फॉर्म परत येतो. फाइल्स टाकून झाल्यावर sudo chown -R apache:apache /var/www/wordpress एकदा पुन्हा चालवा. समजलं का? Owner एक, permissions 755/644 – बस.
Ravindra Bagale's Tip – हिंदी
ध्यान दो: owner ठीक करने के बाद आपने sudo cp या sudo unzip से नई फ़ाइलें डालीं, तो वे root के नाम पर चली जाती हैं – और FTP फ़ॉर्म वापस आ जाता है. फ़ाइलें डालने के बाद sudo chown -R apache:apache /var/www/wordpress एक बार फिर चलाओ. समझ आया? Owner एक, permissions 755/644 – बस.
Why not install an FTP server (vsftpd)?
Plain FTP sends the username and password unencrypted, needs port 21 plus a range of passive ports open in the security group, and adds one more service to patch. With the right owner WordPress needs no FTP at all. When you really need to copy files, upload them to your home folder with SFTP (it runs over SSH on port 22, which is already open for My IP) or scp, copy them into place with sudo cp, and run the chown again.
How do I fix common errors when installing plugins?
Ghabru naka 😅 — these are the usual ones:
| Symptom | Likely cause | Fix |
|---|---|---|
| "Connection Information" form asks for FTP | Files not owned by the PHP-FPM user | Step 1 and Step 2; restart PHP-FPM |
Could not create directory |
Owner fixed on part of the tree only, or FS_METHOD without the owner fix |
sudo chown -R apache:apache /var/www/wordpress |
Installation failed: Download failed |
The instance cannot reach the internet (outbound rules, no route) | Test curl -I https://wordpress.org on the server |
The uploaded file exceeds the upload_max_filesize |
PHP upload limit too low for the theme .zip |
Raise upload_max_filesize and post_max_size in /etc/php.ini, restart PHP-FPM |
| FTP form comes back after a while | New files copied with sudo cp (owned by root), or wp run as root |
Run the chown again; use sudo -u apache for WP-CLI |
wp: command not found with sudo |
/usr/local/bin not in sudo's path |
Use /usr/local/bin/wp |
Learn it properly
This guide is the short path. These free lessons explain the Linux and WordPress background:
Samajla ka? Got it? WordPress asks for FTP because the owner is wrong. Find the PHP-FPM user, run chown, 755/644, and restart PHP-FPM – that's it. Never 777, and no FTP server either. Now install themes and plugins without fear.
समजलं का? WordPress FTP विचारतं कारण owner चुकीचा आहे. PHP-FPM चा यूजर शोधा, chown करा, 755/644, आणि PHP-FPM restart – बस. 777 कधीच नाही, FTP सर्व्हर पण नाही. आता बिनधास्त थीम्स आणि प्लगिन्स इन्स्टॉल करा.
समझ आया? WordPress FTP इसलिए पूछता है क्योंकि owner ग़लत है. PHP-FPM का यूज़र ढूँढो, chown करो, 755/644, और PHP-FPM restart – बस. 777 कभी नहीं, FTP सर्वर भी नहीं. अब बेफ़िक्र होकर थीम्स और प्लगइन्स इंस्टॉल करो.
Frequently asked questions
Why does WordPress ask for FTP details when I install a plugin?
WordPress first tests whether PHP can write to wp-content as the owner of the files. If the files belong to another user (for example ec2-user or root), it falls back to FTP and asks for connection details.
Which user does PHP-FPM run as on Amazon Linux 2023?
By default apache, with Apache and with Nginx. Check with grep -E '^(user|group)' /etc/php-fpm.d/www.conf and ps -o user= -C php-fpm.
Is chmod 777 a good fix?
No. 777 lets every user and process on the server change your files, so one hacked plugin can rewrite the whole site. Use the right owner with 755 folders and 644 files.
What does define('FS_METHOD','direct') do?
It tells WordPress to write files directly with PHP instead of testing ownership. It works only when PHP-FPM can really write to the folders, so fix the ownership first.
How do I install a plugin with WP-CLI?
Run WP-CLI as the PHP-FPM user so the new files get the right owner, for example sudo -u apache /usr/local/bin/wp plugin install classic-editor --activate --path=/var/www/wordpress.
Should I install vsftpd for WordPress updates?
No. Plain FTP sends the password unencrypted and needs port 21 plus passive ports open. Correct ownership, WP-CLI or SFTP on port 22 are safer.