WordPress SSH Update/Install Hostgator VPS Configuration

WordPress SSH Update/Install Hostgator VPS Configuration – Well let’s just start this post out with this statement “changing hosts is a PAIN”. I dediced to switch from Media Temple due to some issues and an old instance of Plesk. Media Temple did not want to volunteer to move everything to a new VPS instance so I moved my 27 domains from media temple to host gator. The process took around 3 days with low level sites and DNS obstacles tackled first. Then the core sites and some straggler hosting customers.

I have been using the automatic update and install method of WordPress for quite some time. For those that are reading this and have used SSH updating and installing for sometime, you know how fast and easy it easy, no to mention from an IT perspective it is far more secure. You can literally shut down your FTP server to conserve resources and lessen your security footprint exposure to FTP type attacks. Media Temple configuration was covered in my article “Media Temple SSH WordPress update”

Some changes in hosting should be noted, as many of the other guides available on google searches will have you looking for a /home/user folder in your directory tree. On Host Gator VPS Servers Running Plesk 10 You will need to place your keys into the /var/www/vhosts/mydomain.com/private/ssh folder. This folder is writable by your web user acct. Make sure you have enabled SSH for this user as either bin/sh or bin/bash. You can do this under you hosting settings for each domain you want to use this procedure on.

Here is what to do:

Dedicated and VPS customers automatically have root SSH access. Root shell allows you to change anyone and anything on your server. If you would like to activate SSH on a sub-account (separate cPanel), simply access WHM with your root login and click the Manage Shell Access link. There you can enable normal and jailed shell for your clients; port 22 for normal and jailed shell.

If you have multiple cPanels which need SSH, you can activate them all within root WHM.

Step 1: Generate the Server-side RSA Keys

#:cd /var/www/vhosts/yourdomain.com/private
#:ssh-keygen

Generating public/private rsa key pair.
Enter file in which to save the key (/var/www/vhosts/mudomain.com/.ssh/id_rsa): 
This will not Work!
Enter the following directory instead ‘/var/www/vhosts/yourdomain.com/private/ssh/.ssh’
Enter passphrase (empty for no passphrase): (just hit enter, no need for a password)
Enter same passphrase again: (same thing, hit enter again)
Your identification has been saved in /var/www/vhosts/yourdomain.com/private/ssh/.ssh
Your public key has been saved in /var/www/vhosts/yourdomain.com/private/ssh/.ssh.pub
The key fingerprint is:
xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx user1@server1.yourdomain.com

The xx:xx:xx etc. will be replaced with your actual fingerprint.

Step 2: Creating an Authorized Keys file:

#:cd /ssh/
#cp .ssh authorized_keys

Step 3: Set the proper file permissions:

#:cd ~/
#:chmod 755 /ssh/
#:chmod 644 /ssh/*

Step 4: Configure WordPress wp-config.php

Add the following lines to your WordPress wp-config.php in the root of your wordpress installation.

define(‘FS_METHOD’, ‘direct’);
define(‘FS_CHMOD_DIR’, 0777 );
define(‘FS_CHMOD_FILE’, 0777 );
define(‘FTP_BASE’, ‘/httpdocs/’);
define(‘FTP_CONTENT_DIR’, ‘/httpdocs/wp-content/’);
define(‘FTP_PLUGIN_DIR ‘, ‘/httpdocs/wp-content/plugins/’);
define(‘FTP_PUBKEY’,’/var/www/vhosts/yourdomain.com/private/ssh/.ssh.pub’);
define(‘FTP_PRIKEY’,’/var/www/vhosts/yourdomain.com/private/ssh/.ssh’);
define(‘FTP_USER’, ‘username’);
define(‘FTP_PASS’, ”);
define(‘FTP_HOST’, ‘yourdomain.com:22’);

That’s It: Now, when you click “upgrade” or “install” on a new plugin, it will bypass the first screen asking for the ftp login details. It will automatically go into the process and start the install/upgrade. You can also use Filezilla to upload files via sftp on port 22. We certainly help this help you setup your own WordPress SSH Update/Install Hostgator VPS Configuration.