Body of Knowledge

knowledge sharing - wiki brain

Archive for June, 2007

mount windows share on a linux box

First install smbmount that should be on smbfs package, for Debian use something like:

sudo apt-get install smbfs

To try and access, create a new mounting point and connect:

sudo mount -t smbfs -o username=<user>,workgroup=<domain> //winserver/share1 /share /share1

To make it permanent add this line to your /etc/fstab as root:

//winserver/share1 /share/share1 smbfs credentials=/home/user/credentials,uid=user,gid=user,dmask=700,fmask=700 0 0

In order to avoid having passwords on your fstab create a file /home/user/credentials like this:

username=<user>
password=<password>
workgroup=<domain>
No comments

web stress test tool

Tired of “time wget”, apache has a simple stress tool “apache benchmark” that goes like this:

ab -kc 10 -t 10 -v 4 -A user:pass "http://uri/dir/file?param=x" > ab_result.txt
No comments

Check valid email addresses

Filter invalid email addresses using shell script:

  • Check for valid domain names
  • cat email_addr.txt | cut -d “@” -f 2 | sort -u| xargs -I {} host -t MX ‘{}’ | grep “not found”;

  • Check for email address RFC compliance
  • cat email_addr.txt | egrep “^[a-Z0-9,\!\#\$\%\&’\*\+/=\?\^\_\`\{\|\}\~\-]+(\.[a-Z0-9,\!\#\$\%\&’\*\+/=\?\^_\`\{\|\}\~\-]+)*@[a-Z0-9-]+(\.[a-Z0-9-]+)*\.([a-Z]{2,})$”

No comments