Linux

VIM

# Delete Blank Lines
:g/^$/d

# Delete EMPTY Blank Lines
:g/^\_$\n\_^$/d

Bash

mkdir `date +%y%m%d%H%M%S`

CentOS

CentOS 6 Netinstall URLs

32 bit: http://mirror.centos.org/centos/6/os/i386/
64 bit: http://mirror.centos.org/centos/6/os/x86_64/

Fedora

Yum Security Updates

yum install yum-security
yum update --security

OpenOffice

  • Disable splash by setting Log0=0 in /usr/lib/openoffice.org/program/sofficerc.

GVIM

Firefox

browser.urlbar.clickSelectsAll

CheckInstall

I haven’t actually used this yet, but I’ll be trying it shortly because it sounds like a brilliant idea. In a nutshell, it builds RPM/DEB/ETC packages from source packages; so rather than going ./configure ; make ; make install, you go ./configure ; make ; checkinstall, and then install the package (this part can be automated too). If you don’t want the package, you just uninstall it as you usually would with your package manager.

Anyone that’s ever installed something from source will probably recognise the advantage in this, but if you haven’t, it means you don’t have to worry about executables being left executable, cron jobs or processes being left running, or files being scattered all over your system. It would appear to be very convenient.

Finding a text string in a dir tree

If you want to find “some text” in an entire directory tree ( let’s say its /your_website_dir/htdocs/)

 cd /your_website_dir/
 find htdocs -print | xargs grep -is "some text"

Plesk

Hide unused FTP Directories

Plesk shows FTP user’s chroot directories (/usr, /var, /etc*) by default, this hides all but the important stuff.

/etc/proftpd.conf

<Directory /home/httpd/vhosts>
	GroupOwner	psacln
	HideNoAccess	on
	HideGroup	root
</Directory>

Server Setup

  • Uncomment auth required pam_wheel.so use_uid in /etc/pam.d/su
  • Change SSH port to 22222.
  • Change Webmin port to 11111.
  • chkconfig yum-cron on
  • Set expose_php = off in /etc/php.ini

NTP

port 123 UDP

yum install ntp

rkhunter

./installer.sh –layout default –install rkhunter –propupd –pkgmgr RPM

#!/bin/bash
rkhunter --update
(rkhunter -c --cronjob 2>&1 | mail -s "Daily Rkhunter Scan Report" root)

chkrootkit

#!/bin/sh
cd /root/chkrootkit
./chkrootkit 2>&1 | grep "INFECTED|Vulnerable"

Mail

IP Blocking

cd /etc/postfix edit access_client file and add the ip address you want to block (e.g 192.168.10.12)

192.168.10.12 REJECT

save and exit, then type

postmap hash:access_client
postfix reload

Forward to another address

If I wanted mail forwarded, I would cd /home/username/ (or cd ~, or even just typing cd will get you home) and edit .procmailrc (if its not there, just create one) to add this:

:0
! user@domain.tld

Copy to another address

To keep a copy, use the ‘c’ flag:

:0c
! user@domain.tld

To bin spam flagged by SpamAssassin

Ok, it’s ruthless, but if you just want to bin spam without seeing it add this.

LOGFILE=procmail.log
Redirect=/dev/null/

:0fw
|/usr/bin/spamc
:0
! ^X-Spam-Status: Yes
$Redirect

The :0fw bit feeds all your incoming mail to the spamassassin daemon for processing. If it’s flagged as spam, an extra header , X-Spam-Status , is added to mail header. It’s also usefull to have a log file of this activity – that’s the LOGFILE line. The log will be in your (or your users) home dir.
If you would rather the spam got redirected to a text file in your home dir, just change /dev/null/ to SPAM

Outlook Migration

http://sourceforge.net/projects/kdepimpi/

Misc

* Arf arf.

Leave a Reply