WordPress: Enabling SSH/SFTP Updates
The first time I dealt with WordPress was when I first started doing IT administration for FanHistory. At that point in time I knew nothing about it and it was breaking horribly. Luckily I managed to fix the issues (which turned out to be Varnish proxy related) and get it standing mostly on its own two feet. One of “minor annoyances” I ran into then and absolutely had to figure out during my migration, was the lack of SSH or SFTP based updates. By default when you go into add or update the plugins (or the software itself) you have only two options FTP and FTPS (SSL). I run neither of these, FTP is majorly old and very insecure. FTPS is just not common. I thought I was stuck doing things manually, until I found out…. You can enable SSH2 based updates in WordPress. Better yet, it is SUPER easy.
Get yourself to a command line, and assuming your running Ubuntu or Debian:
- apt-get install libssh2-php
- /etc/init.d/apache2 restart
- Done!
It is literally that easy, all you need to do is install libssh2-php which is the PHP bindings for libssh2. If your running another flavor of Linux, just search your package manager for “libssh2” and pipe it to “grep php”. You’ll most likely find the package your looking for. You may also need to manually enable the module; Ubuntu does that for me. After you restart Apache with that new module, simply go into your WordPress administration interface and you’ll see the “SSH2” option in any Install/Update screen.
Note: It does support SSH keys, along with the standard password authentication. I’ve not tried a key with a password on it, so if you try it, let me know how it works.
This is just …………AMAZING.. thanks a lot, the easiest solution by far
I think the WordPress SSH SFTP Updater Support plugin makes the whole process a ton easier:
http://wordpress.org/extend/plugins/ssh-sftp-updater-support/
Thanks a million for this. Really didn’t want to use FTP.
Thank you so so so very much! :)
You Are Welcome! Always happy to share those silly little tips that should be _sooo_ much easier to find.
Thanks for this great post ! This should be set on wordpress first page ;)
THANK YOU!!!!
I know this is an old post but it’s still relevant today, I know because I have just done this like 10 minutes ago to sort my updates. Works a treat.
After spending ages looking through config files because I have FTP running on non default ports WordPress just wouldn’t connect no matter what I done and then when I managed to get it to connect there were permission issues caused by Plesk’s quirky user groups so I used this method to do away with all that palava and it’s working a treat!
I’m writing a post about this on the website I linked in this comment, you can check it out if you want, I’m crediting you with this amazing little trick.
^_^
Glad to help. It’s old, but some stuff never goes bad. Unfortunately FTP has not died the death some of us would have liked. No way in hell I’m installing it on my server just for wordpress. Persevere!
That is so true, ftp reigned supreme for a long time but it should now lay it’s hat to rest.
I’ve now just now used this again for another friend who had similar user/group issues as I had and he’s well chuffed. He’s also closed his ftp ports and only opens them once a week during his back-up routine, and I’m working on shifting that to SFTP too now that libssh2 is installed.
More than a dozen of my other friends have also been happy for me to switch them (although to be honest I’m not sure some of them knew what I done, all they heard was ‘it’s safer’ and told me to go ahead haha!) to SFTP too, one of which runs a hosting server with over 2000 WordPress installs on it. You have helped so many people be just that little bit safer alround with this post. I recommended this to my VPS provider and they are considering adding it to their default install too as they have been plagued recently with support tickets regarding the user/group issues after a failed update.
This, my friend, has been one hell of a find for me. Thank you very much!
“Upgrade” to SFTP is good, in fact I refuse to install FTP on any of my servers – point blank. Frankly, I’m surprised this information is so hard to find. WordPress should have the sftp option greyed out (but visible) on ALL installs with some alt text like “please install libssh for PHP to enable this”. Then at least people would know they have the option.
Good luck!
Man, I know this is a little old, but holy crap is this awesome. Thanks a million! I really HATED HATED HATED having to run FTP/FTPS on my server just to update plugins.
I hear you 100%. When I first started with WordPress I was all “Oh HELLLLLL Nawwww (am I running FTP just to update wordpress)”. And it updates so often too, the manual solution is not favorable either… had to find something.
Does this automatically enable this option for a WordPress subdirectory in a WordPress main site (multisite installation) ?
I have not used this plugin in a WP-MU environment. Since the process is “involved” (IE it’s not totally automated), I don’t know if I’d recommend using it in a MU enviroment.
Yep have to agree with the others just made running WP from a CLoud server much easier, many thanks.
I love you, after 2 hours of searching complicated tutorials, I did this in 10 seconds.
This saved my day!!!! Thank you very much.
Awesome, many many thanks!