Handy way to use su in Mac Terminal

 

 

I don’t recall where I  came across this information but passing it along should others need it or for myself to refer back to. I had tried in the past to us the Linux su command to login as a super user but it never worked. I think there are barriers built into to prevent this action.

What you can do to get around that behavior is to use the sudo command.

$sudo su

This will provide you access to the superuser without having to type in sudo every time if you have a number of commands.

SSL for Linux Apache2

Never having done a an SSL update for a Linux based Apache web server I approached this with some trepidation. It’s quite different from an IIS 6 update of which I’ve done many.
Complicating matters, Linux setups can vary from flavor to flavor. I was blessed with what seems to be a version that has the least amount usage in the wild, Gentoo.

The position that I’ve taken is in an office where the previous IT personnel had a huge disdain for any GUI management system that might make this process easier for someone coming in after them.

The biggest fear factor was that the SSL might have a passphrase that would be needed after restarting Apache. This might not only effect the site I was updating but any number of other sites with SSLs that might have the

Since this was a GoDaddy SSL I started out with the basics from the GoDaddy website

The gist of this was that I needed to swap out three files that were in /etc/apache2/ssl with the new files. That being the CRT, KEY and Intermediate CRT. I also wanted to copy the old files to another directory should I encounter any problems, I would have a fall back plan.

I checked the /etc/apache2/vhosts.d directory where the configuration files for the web site resided to verify that path and the file names that it would be expecting. I had to rename the intermediary file to match the one in the config.

About the passphrase. I found this article that explained the procedure to remove a passphrase from a SSL key file. As I found out later the other passphrase on the key files on this server had also been removed because when I restarted the Apache I did not get any prompts for them. Not having knowledge ahead of time if they did or didn’t have a passphrase set and if they did only being able to guess at what it might be this was a great relief. I used a number of websites to research using the openssl tool to remove the passphrase. I followed this one.

Specifically I used there model as shown only changing the name of the paths and files as needed.
Stripping the passphrase in a key to a new file.
openssl rsa -in /etc/httpd/conf/ssh.key/www.domain.com.key.2009 -out /etc/httpd/conf/ssh.key/www.domain.com.key.2009.no_password
Moving the original key file to a backup location
mv /etc/httpd/conf/ssh.key/www.domain.com.key.2009 /etc/httpd/conf/ssh.key/www.domain.com.key.2009.needs_password
Renaming the passphrase stripped key file
mv /etc/httpd/conf/ssh.key/www.domain.com.key.2009.no_password /etc/httpd/conf/ssh.key/www.domain.com.key.2009

I did this all in a staging area and not the actual path.

I also used the key and CRT check commands to verify that my file group was matched.
openssl rsa -noout -modulus -in /etc/httpd/conf/ssl.key/www.example.com.key.2009 | openssl md5
4cb1f8bfbb0a1467f99120886559f7f8

openssl x509 -noout -modulus -in /etc/httpd/conf/ssl.crt/www.example.com.crt.2009 | openssl md5
4cb1f8bfbb0a1467f99120886559f7f8

With all my files in order in my staging directory and the previous SSL files copied into a backup directory I copied my new ones into the working SSL directory.

I used the advise of this site that suggested running a configtest ahead of doing the restart.

# test the configuration first!!
root# /etc/init.d/apache2 configtest

It checked out ok so I then ran the restart.

if the configuration is ok then restart apache

root# /etc/init.d/apache2 restart

Everything worked!!! No passphrase prompts on restart!!!

Yeah!!!

WordPress automatic update goes wrong with 404 and URL of wp-admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F

I haven’t entered any post lately and when I jumped on the admin to enter one I got the nag screen about updating WordPress. Foolishly without thinking I just did the automatic update. I normally go through the GoDaddy upgrade script and have not had problems with it but launching this update from the admin I could not enter login to the admin. I kept getting a 404 error page and the URL was wp-admin/upgrade.php?_wp_http_referer=%2Fwp-admin%2F.

The actual blog did not go done and seem to survive the upgrade. It was only the admin that was not accessible.

Doing some looking around on the web for the simplest way to fix this I saw post about doing a manual install over the update. A number of other suggestions that seemed to much effort. I got a hint from one of the post indicating copying files over similar to a manual install.

Since the page not found was coming from the wp-admin directory I took a gamble and downloaded WordPress 3.4.2 to my local machine. I then uploaded only the wp-admin over my upgraded site. Presto error page is gone.

Upon doing this when logging into the admin page I was prompted to upgrade the WP database. I did and all is well.

Screen Captures In Terminal Services

I spend a lot of time in Terminal Services working on any number of computers. Frequently I’m two levels deep in it. That is I’m remoting into a machine and then remoting into another one from that. One of the annoyance with our current system vendor is that they know so little about their system that they require extensive screen shots for any and all issues.

To accomodate while being in terminal sessions I found this person’s blog to be helpful.

http://www.christiano.ch/wordpress/2010/08/21/capture-alt-print-screen-focused-window-in-rdp-session-in-clipboard/

The crux of it is to use CTRL-ALT-Minus to accomplish this. I have tried it and it works like a charm.

Handy!

Compare two SQL Tables

I was updating one table with data from another. However, when I did this there was a discrepancy between the number of rows I had in the update table and the number of rows updated.

Here the SQL that allowed me to compare and return the rows that were in the source but not the destination.

select * from TableA where not exists
(select * from TableB where TableA.ProductID =TableB.ProductID)

Handy!

Install WordPress using LAMP + Plesk 9

  • Create Domain in Plesk 9.
  • In Domain created add database.
  • Create database user for database
  • Open wp-config.php and add the database info into the fields

/** The name of the database for WordPress */
define(‘DB_NAME’, ‘databasename’);

/** MySQL database username */
define(‘DB_USER’, ‘databaseUserCreated4thisDomain’);

/** MySQL database password */
define(‘DB_PASSWORD’, ‘password’);

/** MySQL hostname */
define(‘DB_HOST’, ‘localhost’);

  • Upload WordPress files to the server

LAMP

I’m starting this blog to document my IT experiences of deploying WordPress & Joomla on LAMP after spending years working in the Microsoft world.

I’m currently having an issue with getting Joomla components installed. This I believe is caused by having the site manged with a Plesk server interface. I’m using Plesk version 9.

I’ve been working with our host Sectorlink, who have helpfully suggested that I Google the problem. Of course I’ve been doing this for sometime. Not helpful.

One thing about Plesk that makes troubleshooting this issue difficult is that there are two php.ini files.

I found on

http://forum.parallels.com/showthread.php?t=84586

the way to determine which of these files the site is using.

php -i phpinfo | grep 'Configuration File'

The answer returned was…

[root@host /]# php -i phpinfo | grep ‘Configuration File’
Configuration File (php.ini) Path => /etc/php.ini