How to use ftp in a shell script
Wed, 08/24/2011 - 15:08 — sandipSometimes I want to FTP a file from one machine to another. Usually, I can do the transfer interactively, but every so often, I would like to have a shell script do the file transfer. This task has eluded me in the past, but I finally figured it out. I've not seen this particular trick documented in the past, so I submit it for your approval...
Install python-2.7 and fabric on CentOS-5.6
Fri, 08/05/2011 - 11:57 — sandipInstall the required packages first:
# yum install gcc gcc-c++.x86_64 compat-gcc-34-c++.x86_64 openssl-devel.x86_64 zlib*.x86_64
Download and install python-2.7 from source:
$ wget http://www.python.org/ftp/pyth on/2.7.2/Python-2.7.2.tgz
$ tar -xvzf Python-2.7.2.tgz
$ cd Python-2.7.2
$ ./configure --with-threads --enable-shared
$ make
# make install
Link the shared library:
# echo "/usr/local/lib" >>/etc/ld.so.conf.d/loca l-lib.conf
# ldconfig
Verify with:
$ which python
$ python -V
Install easy_install:
$ wget http://peak.telecommunity.com/ dist/ez_setup.py
# python ez_setup.py
Install fabric via easy_install:
easy_install fabric
To get the location of site-packages for current version of python:
$ python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
GPG Quick Start
Fri, 07/22/2011 - 13:29 — sandipA quick gpg HOWTO for getting started with GnuPG.
Delete trac tickets
Thu, 07/21/2011 - 15:41 — sandipTo delete trac tickets without installing extra plugins, here's the SQL.
Note: make sure to create a backup of trac.db first.
$ sqlite3 trac.db
delete from ticket_change where ticket = <TicketID>;
delete from ticket_custom where ticket = <TicketID>;
delete from ticket where id = <TicketID>;
Replace "TicketID" with the ID of ticket that needs to be deleted.
To purge out all tickets, use the same sql without the where clause.
- sandip's blog
- Login or register to post comments
- Read more
RBLSMTPD with SYSLOG
Thu, 07/21/2011 - 10:03 — sandipThis modified rblsmtpd features parameter-enabled syslog-based RBL server and source-IP logging.
Review the FAQ for the compile, install and testing...
auotmount shares for vzyum updates
Mon, 06/13/2011 - 10:08 — sandipNote: The directions at "http://wiki.openvz.org/Install
To share the vzyum cache directory between various containers. Edit "/etc/auto.master" to include the following:
/vz/root/{vpsid}/var/cache/yum -cache /etc/auto.vzyum
Include one line for each installed or planned VPS, replacing {vpsid} with the adequate value.
Then, create "/etc/auto.vzyum" file with only this line:
share -bind,ro,nosuid,nodev :/var/cache/yum-cache/share
Restart the automounter daemon.
Edit "/vz/template/centos/5/x86_64/
cachedir=/var/cache/yum-cache/ share
Create the corresponding cachedir:
mkdir /var/cache/yum-cache/share
Test with:
vzyum {vpsid} clean all
This should create all of the yum cache directory at "/var/cache/yum-cache/share" location and should be available to the openvz container via bind mount.
chroot ftp user outside plesk
Fri, 06/03/2011 - 15:49 — sandipTo chroot ftp user outside of plesk, add the user belonging to psacln group.
usemod -g psacln <username>
- sandip's blog
- Login or register to post comments
- Read more
DirectAdmin user and password
Wed, 06/01/2011 - 16:40 — sandipI've had to test some connectivity issues with pop and imap clients without having access to their account info.
"/etc/virtual/{domain.tld}/pas
Generate a new md5-based password hash:
openssl passwd -1
Edit "/etc/virtual/{domain.tld}/pas
Test login to mail.
Once debugging is finished, restore the file back.
- sandip's blog
- Login or register to post comments
- Read more
The Guide to IP Layer Network Administration with Linux
Wed, 05/25/2011 - 09:36 — sandipThe Guide to IP Layer Network Administration with Linux was conceived as a project to document and provide examples for the use of Linux-specific IP networking tools.
The book includes coverage of the following topics: network address translation (NAT), address resolution protocol (ARP), routing, and masquerading. There is a nascent section on bridging, although the focus of the documentation is the use of layer 3 Linux technologies.
Check bots success POSTs in apache access log
Thu, 05/19/2011 - 16:20 — sandipHere is a one liner to check for IPs of bots that are misusing your site.
$ awk '$6 ~ /POST/ && $9 ~ /200/ {print $1 " " $7}' /var/log/httpd/access_log | sort | uniq -c | sort -n | tail
This will give you the top 10 IPs and URIs with a hit count.
Consider blocking those rogue IPs with a high hit count via iptables.
- sandip's blog
- Login or register to post comments
- Read more