Mysql migration from 6 to 5

Now that mysql 6 alpha was announced at it’s end and has not been updated since 2009, I am trying to move a client’s installation to the latest source distro on a brand new server.

Trying to migrate a mysql database from
6.0.11-alpha-community-log MySQL Community Server

to Server version: 5.0.95 Source distribution

getting
ERROR 1286 (42000) at line 37753: Unknown table engine ‘MARIA’

Solution? edit the dump file replacing MARIA with MyISAM

ERROR 1064 (42000) at line 37753: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘PAGE_CHECKSUM=1’ at line 13

Removed the part that says “PAGE_CHECKSUM=1”
Success!

Posted in Uncategorized | Leave a comment

Lock down vsftpd and give access to symlinks

Locking down vsftp is pretty easy, but giving access to symlinks is another issue entirely.

To lock down vsftp, use the method as per the link above (chroot_local_user=YES) or one may also use the feature in vsFTP that allows a list of users who should / shouldn’t be chrooted;

# You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list

Then give a restart with /etc/init.d/vsftpd restart

But there’s a problem if the user needs to access a folder outside the chroot that’s symlinked into his folder. With vsFTP, the folder can’t be seen! Luckily, Radu has the solution for us to resolve the symlink problem.

We create a new folder, then use mount to make an existing otherwise-inaccessible folder available via chrooted vsftp:

mkdir /home/me/webfolder
mount --bind /var/www/webfolder /home/me/webfolder

that’s it, given that the permissions are OK, now the user can do what they need to!

Posted in Uncategorized | Leave a comment

RT could not load a valid user

Was running into a brick wall trying to figure out why a new user could not create a new ticket on a Request Tracker installation;

RT could not load a valid user, and RT’s configuration does not allow
for the creation of a new user for this email (someguy@example.com).

You might need to grant ‘Everyone’ the right ‘CreateTicket’ for the
queue timecard.

Finally after much code-reading and test-account-creating, I searched users including ‘disabled users’ and found there was an old defunct user that had this same email address but from whom permissions had been revoked. Wow that was frustrating. Noting this here in case it might help someone else, or me next time this happens 18 months from now!

Posted in Uncategorized | Leave a comment

Change a ZFS smb share to allow guest access

This is all new to me. Setting up a server with OpenIndiana and napp-it as a local storage box. Following the instructions I was given, the share prompts for a username and password. Since we want automated processes on a number of computers to have access, this was not ideal. After much searching and trying I finally found the correct solution to change the existing smb share to allow guest access; big thanks to Afshin Salek who supplied the correct solution where so many other web pages and man pages had failed me.
https://blogs.oracle.com/afshinsa/entry/how_to_enable_guest_access
# sharemgr set -P smb -p guestok=true -r myshare mygroup
in my environment i did this
# sharemgr set -P smb -p guestok=true zfs/pool0/storage
and it worked! Now the server is available on the windows network without a password being needed.

Posted in Uncategorized | Leave a comment

wp-e-commerce Add To Cart To Go To Shopping Cart Page

I was working on a wordpress site with wp-e-commerce + goldcart and we wanted the “add to cart” button to also go to the cart whenever a product is added. Based on this thread here I was able to figure out what to do:

edit the file ‘wp-content/plugins/wp-e-commerce/wpsc-includes/display.functions.php’
on what is currently line 205, inside this part
<div class='wpsc-add-to-cart-button'>
<form class='wpsc-add-to-cart-button-form' id='product_<?php echo esc_attr( $product_id ) ?>' action=''...

changed:

action=”

to

action=’/products-page/checkout’

Posted in Uncategorized | Leave a comment

Sendmail localhost.localdomain issue

I was having trouble with a particular server identifying itself as localhost.localdomain
Finally I figured out the solution was to edit the /etc/hosts file and change the line with 127.0.0.1 to have only the first portion of the hostname and not the FQDN. Then I also listed that first portion on another line with the LAN ip address. After that the server identified itself correctly on the HELO line.

Posted in Uncategorized | Leave a comment

Can’t extract zip file: An unexpected error is keeping you from copying the file

I downloaded a zip file and tried to extract it (on Windows 7)

An unexpected error is keeping you from copying the file. If you continue to receive this error, you can use the error code to search for help with this problem.
Error 0x80004005: Unspecified error

I copied the file to a linux machine and tried to unzip there – for every file in the archive, the message was

skipping: FILE need PK compat. v6.3 (can do v4.6)

At that point I realized this is some advanced zipping that windows default extraction can’t handle. I fired up 7zip and had no problem extracting right away!

Posted in Uncategorized | Leave a comment

update udev rules on ubuntu

I’m trying to map a bunch of DVD drives to names on unbuntu and mucking around in the udev rules directory.
I found an easy way to get things matched up is to put in a DVD and use ‘df’ command to see where the filesystem has mounted it, for example ‘/dev/scd0’
Then to find the address use ‘udevadm info –query=all –name=scd0’
This provides the info that needs to go into 70-persistent-cd-rules file

Posted in Uncategorized | Leave a comment

Randomize MySQL results the right way?

I wanted to get some randomized results but read many warnings about the dangerous inefficiency of using MySQL’s “ORDER BY RAND()” functionality. After searching around, I came across this solution which seems very good! Copied without permission for posterity.

Often around the internet I find people asking how to get random rows out of MySQL. Typically I see helpful people giving this:
SELECT * FROM table ORDER BY RAND();

However what a lot of people don’t realise, while ok for systems will small tables and limited accessed, this as a huge performance hit when used like this.
The correct way to order your results by a random number is:
SELECT *, RAND() as rand FROM table ORDER BY rand;

Why? Well the answer is actually very simple, ORDER BY RAND() causes the order to be recalculated every time MySQL fetches a new row as for each row RAND() returns a different value. When used in the select the value is only calculated once per row and the results are only ordered once.

Posted in Uncategorized | 1 Comment

Receive Alerts when someone connects with SSH

We needed to set up alerts whenever someone connects to a particular server. Since the server only has one user that can SSH (root is disallowed) it was pretty easy to follow these instructions and have it working in 5 minutes:

Add following content to .bashrc file of the SSH user

echo 'ALERT - ServerName Root Access on:' `date` `who` | mail -s "Alert: ServerName Access from `who | cut -d'(' -f2 | cut -d')' -f1`" you@yourdomain.com

changed ServerName to the actual servername (in 2 places),
changed Root to the actual user who has SSH access (and whose .bashrc was updated)
changed you@yourdomain to my own email.

Conceivably this could be done to every user’s .bashrc file and (assuming you trust them not to change it) you’d always be notified when they log in.

Posted in Uncategorized | Leave a comment