Archive for January, 2010
Fast large file finder
by sudo on Jan.20, 2010, under Linux
The following will display all files over 100MB in size on the server except for those in /proc.
find / -path /proc -prune -o -type f -size +102400k -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}'
For a specific case, multiple paths.
find / -path /images -prune -o -path /var/run/sr-mount -prune -o -path /proc -prune -o -type f -size +102400k -printf "%s %h/%f\n" | sort -rn -k1 | head -n 50 | awk '{ print $1/1048576 "MB" " " $2}'
Install PHP Modules via PECL
by sudo on Jan.13, 2010, under Apache, PHP
First, mount the /tmp partition with exec permissions.
mount -o remount,exec /tmp
To install a package via pecl, run the following.
pecl install ssh2
(If the package is in a state other than stable, append the state after the package name ‘pecl install ssh2-beta’)
Last few lines of the module install will list the location of the library, usually /usr/lib/php/modules. Create a ini file with the module name within /etc/php.d/ with the extension directive.
# cat /etc/php.d/gd.ini
; Enable gd extension module
extension=gd.so
At this point, run the mount command to reestablish noexec for the /tmp partition.
mount -o remount,noexec /tmp
Gracefully restart apache and you are done.
Reset mySQL root password
by sudo on Jan.12, 2010, under mySQL
First, insert the init-file directive into the mySQL configuration under the [mysqld] section.
init-file=/var/lib/mysql/mysql-init
Create /var/lib/mysql/mysql-init with the following line. Replace ‘Changeme’ with a password of your choosing.
SET PASSWORD FOR ‘root’@’localhost’=password(‘Changeme’);
Restart the mySQL service and login as root with the password used above. Remember to remove the init-file directive and the init file you created once complete.