dufault.info

Ramblings of a phone weenie, Linux sysadmin, and other things geeky

Check out my new article on itnewb: Easy Logins With SSH On Linux!

I wrote an article for a friends site, check it out: Guide To Easy Logins With SSH On Linux
I didn’t know that article writing took so long — the amount of writing, rewriting, critiquing, etc etc was a new experience. I’ll have to keep writing articles — teaching others is a good way to [...]

Logging all BASH commands to history, and keeping people from deleting/emptying it

Usually on Linux server, we have issues with logging the commands that our users are running, especially with BASH. BASH doesn’t log the commands as soon as they’re executed, and the user can do a number of simple things to prevent the log from ever being written to the disk, preventing you from knowing [...]

Enable date-stamp in your .bash_history file

While it’s easily cleared by a malicious person, this can easily extend the usefulness of your history file with the information of when you ran that command.
This works in bash v3 and up.
If you’d like to add the timestamping to all users on the machine, the file you’d want to edit is probably /etc/profile.  If [...]

Billix

I  wanted to mention that I’ve been looking for something like for this a bit — a USB key that comes with a way to install multiple Linux distributions.  While at work, we primarily use Gentoo, we still have a Ubuntu server or CentOS install to do occasionally, and it would be nice to have [...]

A Script to Optimize Fragmented Tables in MySQL

I wrote a BASH script that will run “optimize table” on any table fragmented. it’s pretty tidy, and you can supply usernames and passwords, and even run it against remote MySQL databases.
Here’s an example of it’s output:
root@lit [~]# mysqlFragFinder
MySQL fragmentation finder (and fixer) v0.7.2, written by Phil Dufault ( http://www.dufault.info/ )
Found 59 databases
Checking someforum_forum … [...]

MySQL Tuner

I’ve been using this for the past two weeks:
MySQL Tuner
I’ve used on servers running on MySQL 4.0, or 5.1 lately to tweak their preformances.  Itt’s an awesome script, and I recommend using it on any MySQL server you can find.

Making SSH connections to your frequent remote hosts faster with ControlMaster

I recently learned of a newish OpenSSH feature, a feature that let’s you reuse existing SSH connections.
If you want to enable this functionality on a per-host basis, then you can setup your ~/.ssh/config file like this:
Host *
ControlMaster no
ControlPath ~/.ssh/master-%l-%h-%p-%r.sock
Host someserver
Compression yes
ControlMaster yes
To enable it:
ssh -f -N someserver
After that, just ssh in like you would normally:
ssh [...]

Hotswap a SCSI, SAS, or SATA drive in Linux

There seems to be not a lot of information on Google about this, thus, I post.
At my work, the majority of our servers have hot-swappable drive bays — however, Linux doesn’t usually automatically notice the drive is gone. Worse, sometimes it doesn’t even notice new drives hooked up.
Now, SCSI and SAS both support hot-plugging [...]

Typespeed

It came up in IRC today that there was a typing game called typespeed — one of the categories is “Unix Commands.”  Better yet, this supports head to head networking mode, so you can play against people in your office, I didn’t even need to edit my firewall configuration on Ubuntu.
Playing your coworkers is good [...]

Installing libtidy in PHP5 on a CentOS cPanel server

To install libtidy in PHP5, it’s really quite easy.
Make sure your /tmp directory doesn’t have something like noexec set on it, otherwise this would be more difficult.
Here’s the install command:
pecl install http://pecl.php.net/get/tidy-1.2.tgz
Find where your main php.ini file is:
root@server [~]# php -i|grep php.ini
Configuration File (php.ini) Path => /usr/local/lib
Loaded Configuration File => /usr/local/lib/php.ini

Add the module to your [...]

Next Page »