Archive for 2009

Mounting Windows shares on Linux

mount -t cifs -o username=user,password=pass,rw // /mnt/mydir/ You could make this persistent on boot by putting it in /etc/rc.local for example.

Creating custom Spamassassin rules

example: body            Job_Scam_Rule  /craftmediadepartment|LOUWILLE ENGINEERING|ABLE TEXTILE DEPARTMENT/ describe        Job_Scam_Rule  “Spam is not allowed” score           Job_Scam_Rule  2000 2000 2000 2000 or header LOCAL_ED_SUBJECT      Subject =~ /\bED\b/ score LOCAL_ED_SUBJECT       40 needs to go in the users user_prefs file if allow_user_rules is enabled in Otherwise can be done on a serverwide basis in /etc/mail/spamassassin/ or similar manual: […]

screen on Linux

After installing screen you can have multiple sessions per ssh connection and they can be resumed if the connection is lost. type screen to start Now open a new window with “Ctrl-A” “c” You can create several windows and toggle through them with “Ctrl-A” “n” for the next window or “Ctrl-A” “p” for the previous […]

Configuring a samba server

install samba via yum etc. Create the smb.conf config file in /usr/local/samba/lib/smb.conf Basic smb.conf sample: [global] workgroup = DEVELOPMENT encrypt passwords = yes [homes] guest ok = no read only = no browseable = no

Installing Ruby on Rails on Plesk

To Install Ruby on Rails on a Plesk Server: yum groupinstall “Plesk 8.1 Ruby” yum install psa-miva (If Miva required) yum groupinstall “Plesk 8.1 FastCGI” (if FastCGI required) To Configure Ruby on Rails on a Plesk Server: 1. Create a domain in Plesk with Physical hosting. 2. Ensure that bin/bash access is enabled. 3. Ensure […]

rsync backups

rsync can be used as an effective backup tool: rsync -avz –delete -e “ssh -i rsync/mirrorkey” backup@ /backup/ If there’s a lot of data and speed takes importance over security, a weaker cipher such as blowfish could be used: “ssh -c blowfish -ax -i rsync/mirrorkey” Be careful with the –delete flag, it will delete files […]

RPM Examples

Install RPM: rpm -ivh package.rpm Upgrade RPM: rpm -Uvh package.rpm Import an RPM GPG key: rpm –import /media/cdrom/RPM-GPG-KEY Getting detailed information about the package wget: rpm -qi wget Showing all the files installed by the package wget: rpm -ql wget

Enable Disk Quotas on plesk for Linux

First of all make sure that quota is supported by kernel. It should be compiled into the kernel or loaded as module. You can check if quota is configured properly with this command line: /usr/local/psa/admin/sbin/usermng –isquotable Normally, it should return “0”. If the utility returns the following error message: usermng: Unable to turn on user […]

Managing the Qmail queue

/var/qmail/bin/qmail-qstat or for more detailed info: /var/qmail/bin/qmail-qread qmail configuration: /var/qmail/control list count of email addresses in queue grep -h “^From:” /var/qmail/queue/mess/*/* | sort | uniq -d -c for big big queues: (will take a while) find /var/qmail/queue/mess/21/  -type f -print0 | xargs -0 -P1 -n64 grep -h “^From:” |sort | uniq -d -c search through […]

Managing the Postfix queue

This command will delete one specific email address from the mail queue (taken from the postsuper man page): #mailq | tail +2 | grep -v ‘^ *(‘ | awk  ‘BEGIN { RS = “” } { if ($8 == “” && $9 == “”) print $1 } ‘ | tr -d ‘*!’ | postsuper -d […]