• Home
  • Archive
  • Tools
  • Contact Us

The Customize Windows

Technology Journal

  • Cloud Computing
  • Computer
  • Digital Photography
  • Windows 7
  • Archive
  • Cloud Computing
  • Virtualization
  • Computer and Internet
  • Digital Photography
  • Android
  • Sysadmin
  • Electronics
  • Big Data
  • Virtualization
  • Downloads
  • Web Development
  • Apple
  • Android
Advertisement
You are here: Home » Automatic WordPress Update Via SSH Authentication

By Abhishek Ghosh March 30, 2015 6:48 am Updated on March 30, 2015

Automatic WordPress Update Via SSH Authentication

Advertisement

Here is How To Configure WordPress Automatic WordPress Update Via SSH Authentication For a Very Secured WordPress Setup on Multiple Nodes. Normally, if we do not CHMOD WordPress Directories and Files to writable, the WordPress installation asks for FTP username and password; which again we can bypass by adding one line in wp-config.php file. However, it is possible to setup more secure method of authentication, that is adding one SSH user and adding few lines in wp-config.php file. This guide on automatic WordPress update via SSH authentication is exactly for this setup.

 

Automatic WordPress Update Via SSH Authentication : Preparation

 

We need to have SSH2 extension installed for PHP. That depends on the Server OS, Version and Webserver. In general, for deb Linux we need to check by running :

Vim
1
php --ri ssh2

This should give this output :

Advertisement

---

Vim
1
2
3
4
5
6
ssh2
 
SSH2 support => enabled
extension version => 0.12
libssh2 version => 1.4.3
banner => SSH-2.0-libssh2_1.4.3

Else you need to check the documents to properly install it. Another way to check is to create a test.php file with the following content in FTP root :

Vim
1
2
3
4
5
6
7
8
<?php
 
if (function_exists('ssh2_connect'))
{
    echo "true";
}
 
?>

If you point to the PHP file from browser, you’ll see true as output for the right setup. Who are the owners of the WordPress files, that is important. Because, root‘s ~/.ssh location and other user’s ~/.ssh will be different.

Vim
1
2
cd ~/.ssh
cat authorized_keys

For OpenStack, you will have a Nova generated key. You can run ssh-keygen command and enter any custom nameto avoid the file names to be id_rsa.pub and id_rsa. Set a passphrase to add additional security. If ownership of the files is not correct, you’ll need to chmod these files :

Vim
1
2
chmod 755 ~/.ssh
chmod 644 ~/.ssh/*

 

Example of the Above

 

Vim
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
sudo adduser wordpress-user
cd /usr/share/nginx/html
sudo chown -R www-data:wordpress-user /usr/share/nginx/html/
sudo su - wordpress-user
cd ~
ssh-keygen -t rsa -b 4096
# save at
# /home/wordpress-user/wp_rsa
exit
sudo chown wordpress-user:www-data /home/wordpress-user/wp_rsa*
sudo chmod 0640 /home/wordpress-user/wp_rsa*
sudo mkdir /home/wordpress-user/.ssh
sudo chown wordpress-user:www-data /home/wordpress-user/.ssh/
sudo chmod 0700 /home/wordpress-user/.ssh/
sudo cp /home/wordpress-user/wp_rsa.pub /home/wordpress-user/.ssh/authorized_keys

 

Automatic WordPress Update Via SSH Authentication : Editing wp-config.php

 

Now, edit the wp-config.php file and add these lines :

Vim
1
2
3
4
5
6
7
8
9
10
define('FS_METHOD', 'ssh2');
define('FTP_BASE', '/usr/share/nginx/html');
define('FTP_CONTENT_DIR', '/usr/share/nginx/html/wp-content/');
define('FTP_PLUGIN_DIR ', '/usr/share/nginx/html/wp-content/plugins/');
define('FTP_PUBKEY','/home/wordpress-user/wp_rsa.pub');
define('FTP_PRIKEY','/home/wordpress-user/wp_rsa');
define('FTP_USER','wordpress-user');
define('FTP_PASS','********');
define('FTP_HOST','127.0.0.1:22');
// define('FTP_HOST','10.0.0.1:22');

Automatic WordPress Update Via SSH Authentication

We can further restrict by editing / adding the subnet like from="10.0.0.1" before ssh-rsa in this file :

Vim
1
/home/wordpress-user/.ssh/authorized_keys

FTP host will be edited rightly like shown above. In this case, you can restrict the access of the other nodes to wp-config.php file. Unless there are many nodes, this much security is usually not required.

This Article Has Been Shared 818 Times!

Facebook Twitter Pinterest
Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, Orthopaedic Surgeon, Author and Blogger. You can keep touch with him on Twitter - @AbhishekCTRL.

Here’s what we’ve got for you which might like :

Articles Related to Automatic WordPress Update Via SSH Authentication

  • Installing WordPress via PHP Script : Cloud Sites and Other WebHosts

    Installing WordPress via PHP Script is a very way to install WordPress on your Server via FTP without Shell Access. The script automatically download and unzip.

  • mod_pagespeed and Google PageSpeed Service

    mod_pagespeed and Google PageSpeed Service has been evaluated and from our tests some parts of mod_pagespeed is good but Google PageSpeed Service lags far away.

  • Creating Spinning Logo for WordPress Genesis and Others

    Creating Spinning Logo for WordPress Genesis and Other Themes is quite easy. Move the mouse over the logo and it will spin. You can control the speed,behavior.

  • WordPress Optimization Tricks : The PHP Files

    WordPress optimization tricks offers you some uncommon and common hacks to optimize the Page Loading speed specific to WordPress files only.

  • W3 Total Cache Pro and WordPress Page Loading Speed

    W3 Total Cache Pro has recently been introduced by W3TC Plugin developer and here is some questions frequently asked by the WordPress users as suggestion.

Additionally, performing a search on this website can help you. Also, we have YouTube Videos.

Take The Conversation Further ...

We'd love to know your thoughts on this article.
Meet the Author over on Twitter to join the conversation right now!

If you want to Advertise on our Article or want a Sponsored Article, you are invited to Contact us.

Contact Us

Subscribe To Our Free Newsletter

You can subscribe to our Free Once a Day, Regular Newsletter by clicking the subscribe button below.

Click To Subscribe

Please Confirm the Subscription When Approval Email Will Arrive in Your Email Inbox as Second Step.

Search this website…

 

Popular Articles

Our Homepage is best place to find popular articles!

Here Are Some Good to Read Articles :

  • Cloud Computing Service Models
  • What is Cloud Computing?
  • Cloud Computing and Social Networks in Mobile Space
  • ARM Processor Architecture
  • What Camera Mode to Choose
  • Indispensable MySQL queries for custom fields in WordPress
  • Windows 7 Speech Recognition Scripting Related Tutorials

Social Networks

  • Pinterest (21K Followers)
  • Twitter (5.3k Followers)
  • Facebook (5.7k Followers)
  • LinkedIn (3.7k Followers)
  • YouTube (1.3k Followers)
  • GitHub (Repository)
  • GitHub (Gists)
Looking to publish sponsored article on our website?

Contact us

Recent Posts

  • 5 Sectors That Have Undergone Revamps in Digital Landscape February 24, 2021
  • What You Can Control with a Smartwatch and ESP32 February 23, 2021
  • What Does Data Cleansing Mean? February 21, 2021
  • How to Find the Right Software for Your Company February 20, 2021
  • What is Code Refactoring? February 19, 2021

 

About This Article

Cite this article as: Abhishek Ghosh, "Automatic WordPress Update Via SSH Authentication," in The Customize Windows, March 30, 2015, February 25, 2021, https://thecustomizewindows.com/2015/03/automatic-wordpress-update-via-ssh-authentication/.

Source:The Customize Windows, JiMA.in

 

This website uses cookies. If you do not want to allow us to use cookies and/or non-personalized Ads, kindly clear browser cookies after closing this webpage.

Read Cookie Policy.

PC users can consult Corrine Chorney for Security.

Want to know more about us? Read Notability and Mentions & Our Setup.

Copyright © 2021 - The Customize Windows | dESIGNed by The Customize Windows

Copyright  · Privacy Policy  · Advertising Policy  · Terms of Service  · Refund Policy