Josheli
  • Home
  • Knob
    • Blog
    • Running
    • Soccer
    • Technology
  • Projects
    • Overview
    • No Instagram
    • Google Photos WordPress Plugin
    • Plex Channels
    • Sh***y Game
    • Soccer In Colorado
    • Statrat
    • The Dot Game
    • Vox cPanel Hacks
    • WW Points Calculator
  • About

Interests

  • Knob
  • Running
  • Soccer
  • Technology

Other Sites

  • Family Vance
  • Texas Longhorns News

Projects

  • Overview
  • No Instagram
  • Google Photos WordPress Plugin
  • Plex Channels
  • Sh***y Game
  • Soccer in Colorado
  • Statrat
  • The Dot Game
  • Vox cPanel Hacks
  • WW Points Calculator

Social Things

  • Family Photos
  • Juiskie’s Instagram
  • Scooter’s Facebook
  • Scooter’s Instagram
  • YouTube Videos
  • DV’s Github
  • Tweet Tweet
Knob , Technology

Setting up WordPress to use SSH for Updates

by dv December 18, 2015 No Comments

Here’s how I set up WordPress to seamlessly use SSH, rather than FTP, for updates. Using this method, I never have to enter a password, never have to (S)FTP, never have to mess with file permissions.

Like the WordPress Codex says, there are two ways to setup WordPress to use SSH:

  • The SSH SFTP Updater plugin
  • SSH2 PHP Extension

I already had the SSH SFTP Updater plugin installed, but if you don’t, it’s just a matter of installing like any other plugin. Once I had it installed, I had been entering my ssh password manually each time I wanted to update or install plugins, themes, etc. What a pain. (And insecure, until I set up my WordPress site to use SSL.)

To mitigate that pain, and have WordPress use password-less ssh, you need to create public and private keys on your web server. When you run the following command, you will be asked some questions. Make sure you leave the passphrase blank.

ssh-keygen -t rsa -b 4096

Two key files, id_rsa.pub and id_rsa, will be created in your ~/.ssh directory. Change in to that directory and copy your id_rsa.pub key to a file called authorized_keys.

cd ~/.ssh/
cp .ssh/id_rsa.pub .ssh/authorized_keys

Now change permissions so WordPress can access those keys.

cd ..
chmod 775 .ssh
chmod 644 .ssh/*

Next, so that WordPress won’t ask you what method to use when updating, edit your wp_config.php file with the following code:

define('FTP_PUBKEY','/home/user/.ssh/id_rsa.pub');
define('FTP_PRIKEY','/home/user/.ssh/id_rsa');
define('FTP_USER','user');
define('FTP_PASS','');
define('FTP_HOST','127.0.0.1:22');
define('FS_METHOD', 'ssh2');

And that’s it. You should now be able to update, install, delete plugins and themes from your WordPress without entering any ssh or (s)ftp information.

Related Content:

  • Which ruby? by Dv February 26, 2011 Playing around with Ruby, Rails, RefineryCMS... anything installed? ~ $ which ruby nope, ok... ~ $ sudo apt-get install ruby…
  • Those were days by Dv February 24, 2010 Well what's this? A web log, or as the kids call it these days, a b'log? Why yes, yes it…
  • Another blog about me plus some other stuff by Dv March 20, 2008 I said "I'm slow." Fletcher said, "save it for the blog." So here it is. I'm slow. By slow I…
  • Aptana Studio 3 Sync with Mapped Drives by Dv December 2, 2011 Soldiering on with Aptana, fighting as I go, here's how I was able to set up automatic synchronization between my…
  • Josheli, What Happened? by Dv May 26, 2006 [UPDATE]The cpanel stuff and statrat are back.[/UPDATE] There used to be a bunch of crappy php scripts on this site.…
  • Previous Running a Plex Media Server on an Old Laptop3 years ago
  • Next Installing Let’s Encrypt SSL on Nginx and WordPress3 years ago

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Popular Posts

  • Josheli, What Happened? (7,865)
  • More Janky Snowboarding Video (4,446)
  • Running a Plex Media Server on an Old Laptop (4,424)
  • Come Ski With Me (4,271)
  • Install Ubuntu on HP Laptop with UEFI and new SSD Hard Drive (3,875)

Random Read

Ok, ok, ok
1. So I don't actually do "endurance" races. It was literary expedience. 2. This stuff…

Read More

Google Photo
Google Photo
Google Photo
Google Photo

RSS From Familyvance

  • Snowshoeing at Brainard Lake
  • Fishing and Hiking at Golden Gate Canyon State Park
  • Rainbow Trout Fishing Report at Waneka Lake
  • Weightless Texas-Rig Plastic Worms at Sawhill Ponds and Coot Lake
  • Sawhill Ponds Fishing Report
2019 Josheli. Donna Theme powered by WordPress