Oct 16, 2012

WordPress Update for SSH

Filled under:

WordPress Update for SSH
 Notice that this article is not for beginners, because the first thing is that you have full access to your server , using the command interface, in this case the shell.

That if, when you spend that little scare, not inconvenience you greatly facilitates life, because everything is faster by SSH .

So, fears were, if we saw a while as by WordPress install SSH , and even as update WordPress with subversion , today we update WordPress via SSH , and we'll see a couple of ways to do this.

1. WordPress Update for SSH

In the following commands is always assumed that they are doing in the directory of your WordPress ( myweb in the example). So now this clear leaving first thing to do is download the latest version and removing it , we will do so:

wget http://wordpress.org/latest.tar.gz
tar xfvz latest.tar.gz

Then delete the directory ' wp-admin 'and' wp-includes 'old:

rm -rf ./wp-admin
rm -rf ./wp-includes

To then go to the folder " wordpress "where we extracted the latest version of WordPress and move all files to the directory on your WordPress :

cd wordpress
mv * ../miweb/

When you start the process the shell prompts you to overwrite some files and folders , also within the directory 'wp-content', and there you decide that you overwrite it and what not, my advice always you know, do not ever with ' wp-content ' .

When the process left the folder " wordpress "and delete the directory and file ' latest.tar.gz ':

cd ../
rm -rf ./wordpress/
rm -f latest.tar.gz

The final step is to access your desktop and update the database if asked WordPress.

2. Enable SSH2 to update WordPress

A WordPress possibility that perhaps do not know is that you can use SSH for upgrades and installations of plugins and themes. The first thing to do is check if your accommodation is installed SSH2 PHP extension or not . To test PHP executes the following command:

var_dump( extension_loaded( 'ssh2' ) );

If the result is yes ( true ) then that means it is installed , but is not, of course. If not installed and want to have it, one of two, ask your hosting provider you install it, or if you have a VPS or dedicated server install yourself. In the latter case the mode is as follows:

The first is to create a series of public and private keys that will be used to identify you. To create them we use the following command in your SSH client:


I asked for the file name. You can leave it blank or put any name you can think of. If left blank file names will id_rsa.pub and id_rsa . You can also set a password here to add extra security, or if you prefer leave blank also.

Then touches add keys necessary to file authorized_keys . In our example the SSH keys are created and saved in the ' . ssh ', within the root directory.

cd .ssh
cp id_rsa.pub authorized_keys

The next thing is to change the permissions so that WordPress can access these keys :

cd ../
chmod 755 .ssh
chmod 644 .ssh/*

Of course, the user will have to change the directory if you are running PHP as another user.

Now that we have configured and running SSH2 should see the following screen when you update or install a plugin or theme:
WordPress Update for SSH

In this screen the user is the username you used SSH to access and carry out all the commands, and the key is the password you requested when you ran the command ssh-keygen . If you did not choose a password then leave the field blank. If you also do not want to have to repeat this step every time you update then add the following to your wp-config.php :


Of course, changing the routes for yours , with special attention to the absolute paths of lines 1 and 2, remember this is an example, you must not copy and paste it as is but suit your credentials and installation.

After you save the changes WordPress will perform the file transfer using SSH updates .

What is not for you this?, Because then you can automatically update WordPress to normal, or to the beast .


Post a Comment