Mass Reset WordPress User Passwords

I wrote a simply Bash script to reset all WordPress user passwords, enjoy

Basically, all users from the database are retrieved and put in an array then a random password is generated on line 6, password is reset on line 7, retrieve the users email on line 9 then finally send the user an email with the new username and password on line 10. You also want to echo back the username and password that was set in case you need that for your records

Replace with the name of the database, also the script assumes you are connecting with a user that has its MySQL password in ~/.my.cnf so no user or password options are specified for MySQL, if you have to specify a user and password, change the lines with mysql to

Change to the MySQL user and to the MySQL user


Mass reset Linux shell passwords

The passwd utility on Linux by default runs in interactive mode and it makes it difficult to reset shell passwords for a large number of users. I found the one liner below to be very helpful in accomplishing this task

Each user with an active shell will have that as part of the entry in /etc/passwd. So we are basically searching for each user with shell /bin/bash, excluding user root and resetting their passwords. We generate a random password using

and once the password change is successful, we print the username and password to the terminal


Yum and rpm commands hang

I recently encountered an issue where yum and rpm commands were hanging. For instance the command below does nothing and can hardly be killed using Crtl + C.

To resolve the issue, clear the database for yum and rebuild it by running the following commands


Form Autosave

Form AutoSave saves form input as you type so the form fields can be retrieve even after you accidentally close the tab, experience a computer crash or accidental reboot.

To restore the form fields simply click on the floppy disk icon after loading the page with the form

The YouTube video below explains it all

The extension can be downloaded from the Google Chrome Web Store at

Please report bugs to or use the contact form on



WordPress Visual Editor Broken

It appears a recent upgrade to WordPress 3.5 is causing the Visual or Text Editor to break. I found errors with the JavaScript within post.php and tinymce. The console in Chrome shows the errors below:




Installing the plugin use-google-libraries seems to resolve the issue.



Limit FTP Access to certain IPs

For whatever reason, be it security or otherwise, if you wish to limit FTP access to a certain IP, the IP tables rule below should do the trick:

iptables -A INPUT -s ! x.x.x.x -p tcp --dport 21 -j DROP

Replace x.x.x.x with the IP Address. The rule simply means, if IP is not x.x.x.x do drop the connection to port 21

You can do the same for other ports say SSH

iptables -A INPUT -s ! x.x.x.x -p tcp --dport 22 -j DROP

For services, you can also look into using /etc/host.allow, For instance to deny access to WHM.

whostmgrd: : allow

whostmgrd: ALL : deny





The uploaded file could not be moved

If you are experiencing issues uploading files with the Media uploader in WordPress, the upload may be failing due to one of the following:

  1. Uploaded file is too large- By default the upload limit for WordPress is controlled by the upload_max_filesize/post_max_size limits in your php.ini file. If the file you are trying to upload is bigger than those limits, the upload will fail. You can increase those limits to increase the upload limit for WordPress.
  2. Upload path for WordPress is incorrect or unwritable – The default upload directory for WordPress is wp-content/uploads. If the directory is incorrect or it is unwritable you will be an error similar to the one in the screenshot below:
    To correct the upload path, navigate to Settings >> Media from your WordPress dashboard for the “Store uploads in this folder” field enter wp-content/uploads then click Save Changes.
    If that does not correct the issue then wp-content/uploads or the currently upload path is not writable. The permissions for the folder should be set to 755. I do not suggest 777 since that makes the directory writable by group and that could make your WordPress site vulnerable. You can change the permissions using any FTP client or from SSH with the command chmod -Rv 755 wp-content/uploads



E-links opens external links in new windows, adds CSS to external links and
add rel=”nofollow” to all external links

== Installation ==

1. Download, unzip and upload to your WordPress plugins directory
2. Activate the plugin within you WordPress Administration
3. Configuration options under Settings >> E-links

To download the plugin, please go to


Google Analytics-Show Full Referrer URL

It is sometimes useful to know the exact page a visitor was referred from to your site. Google Analytics shows you only the domain by default such as, to find the exact page URL, you can create a custom report.

  1. Click on Custom Reporting 
  2. Click New Custom Report
  3. Give the report any name of your choice-I chose to name mine Full Referrer URL 
  4. Click on Add Metric Group, then Visitors and choose Visits
  5. Click add dimension, choose Content then Full Referrer
Your report should look something like the image below(click image to view larger version):
Click on Save.

You will then be directed to a page that shows the report as below (click the image to view a larger version):


Fixing IE8 bugs

When it comes to the way browsers render pages, Internet Explorer has a mind of its own and does not obey any web standards with Internet Explorer 8 being the worst offender.
While working on the plugin Contact Tab, I noticed every version of Internet Explorer except 8 displayed the form correctly. To get IE8 to play nice, use the code below to let it render pages like IE7

if you are not using WordPress/bbPress the last two lines are not needed.


Contact Us