Sometimes 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...
How to use ftp in a shell script
Submitted by sandip on Wed, 08/24/2011 - 15:08Install python-2.7 and fabric on CentOS-5.6
Submitted by sandip on Fri, 08/05/2011 - 11:57Install 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/python/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/local-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
Submitted by sandip on Fri, 07/22/2011 - 13:29A quick gpg HOWTO for getting started with GnuPG.
Delete trac tickets
Submitted by sandip on Thu, 07/21/2011 - 15:41To 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
Submitted by sandip on Thu, 07/21/2011 - 10:03This 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
Submitted by sandip on Mon, 06/13/2011 - 10:08Note: The directions at "http://wiki.openvz.org/Install_OpenVZ_on_a_x86_64_system_Centos-Fedora#STEP_12" did not quite work for me as ".gpgkeyschecked.yum" gets created in the yum-cache directory as well and is not available to the containers. The workaround below worked for me.
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/config/yum.conf" and change cachedir location:
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
Submitted by sandip on Fri, 06/03/2011 - 15:49To 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
Submitted by sandip on Wed, 06/01/2011 - 16:40I've had to test some connectivity issues with pop and imap clients without having access to their account info.
"/etc/virtual/{domain.tld}/passwd" file holds their user and md5 password hash. Make sure to backup this file first.
Generate a new md5-based password hash:
openssl passwd -1
Edit "/etc/virtual/{domain.tld}/passwd" file replacing the password hash with the above.
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
Submitted by sandip on Wed, 05/25/2011 - 09:36The 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
Submitted by sandip on Thu, 05/19/2011 - 16:20Here 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
Recent comments
7 years 44 weeks ago
7 years 44 weeks ago
7 years 44 weeks ago
7 years 44 weeks ago
8 years 24 weeks ago
8 years 26 weeks ago
8 years 49 weeks ago
9 years 3 weeks ago
9 years 3 weeks ago
9 years 12 weeks ago