• 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 656 Times!

Facebook Twitter Pinterest

Abhishek Ghosh

About Abhishek Ghosh

Abhishek Ghosh is a Businessman, 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

Get new posts by email:

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 (24.3K Followers)
  • Twitter (5.8k 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

  • Exploring the Benefits and Advantages of Microsoft’s Operating System March 22, 2023
  • Web Design Cookbook: Accessibility March 21, 2023
  • Online Dating: How to Find Your Match March 20, 2023
  • Web Design Cookbook: Logo March 19, 2023
  • How Starlink Internet Works March 17, 2023

About This Article

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

Source:The Customize Windows, JiMA.in

PC users can consult Corrine Chorney for Security.

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

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

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

We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies.
Do not sell my personal information.
Cookie SettingsAccept
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. These cookies ensure basic functionalities and security features of the website, anonymously.
CookieDurationDescription
cookielawinfo-checkbox-analytics11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Analytics".
cookielawinfo-checkbox-functional11 monthsThe cookie is set by GDPR cookie consent to record the user consent for the cookies in the category "Functional".
cookielawinfo-checkbox-necessary11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookies is used to store the user consent for the cookies in the category "Necessary".
cookielawinfo-checkbox-others11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Other.
cookielawinfo-checkbox-performance11 monthsThis cookie is set by GDPR Cookie Consent plugin. The cookie is used to store the user consent for the cookies in the category "Performance".
viewed_cookie_policy11 monthsThe cookie is set by the GDPR Cookie Consent plugin and is used to store whether or not user has consented to the use of cookies. It does not store any personal data.
Functional
Functional cookies help to perform certain functionalities like sharing the content of the website on social media platforms, collect feedbacks, and other third-party features.
Performance
Performance cookies are used to understand and analyze the key performance indexes of the website which helps in delivering a better user experience for the visitors.
Analytics
Analytical cookies are used to understand how visitors interact with the website. These cookies help provide information on metrics the number of visitors, bounce rate, traffic source, etc.
Advertisement
Advertisement cookies are used to provide visitors with relevant ads and marketing campaigns. These cookies track visitors across websites and collect information to provide customized ads.
Others
Other uncategorized cookies are those that are being analyzed and have not been classified into a category as yet.
SAVE & ACCEPT