Archive for the ‘ How tos ’ Category

Recently I was looking for a solution which would allow me to transfer files and make mysql db connection securely between to servers with public IP address located in different hosting companies. That is when i decided to try out pptp – one of the machine is CentOS (pptp server) and the other one is Ubuntu (pptp client). Here goes the setup –

1. Server side

Install pptpd

rpm -ivh http://acelnmp.googlecode.com/files/pptpd-1.3.4-1.rhel5.1.x86_64.rpm

Edit /etc/pptpd.conf to look like

option /etc/ppp/options.pptpd
logwtmp
localip 172.16.1.1
remoteip 172.16.1.2

Edit /etc/ppp/options

name pptpd
refuse-pap
require-mschap-v2
require-mppe-128
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd

Edit /etc/ppp/chap-secrets

myusername  pptpd   mypassword       *

Finally start pptpd daemon

/etc/init.d/pptpd start

2. Client Side

apt-get install pptp

Edit /etc/ppp/chap-secrets

myusername  pptpd   mypassword       *

Edit /etc/ppp/peers/myprovider

pty "pptp xx.xx.xx.xx --nolaunchpppd"   ###xx.xx.xx.xx: remote host IP
name myusername   
remotename PPTP
require-mppe-128
file /etc/ppp/options.pptp
ipparam myprovider
mru 1412
mtu 1412

Finally, connect to pptp server with

pon myprovider debug dump logfd 2 nodetach

In both servers, make sure the ports for pptp are open – the default is 1723.

Unblocking a host

Is your firewall blocking connection from a host and still you want to unblock the IP address of the remote host? Here is one way of doing it:

1. Do a listing of firewall rules and grep the IP (eg. 1.2.3.4)
$ /sbin/iptables -L INPUT -n –line-numbers | grep 1.2.3.4

-write down the line number.
-If the chain name is different or user defined, replace “INPUT” by the relevant chain name such as OUTPUT.

2. Delete the line number (eg. for line number 99 and chain INPUT)

$/sbin/iptables -D INPUT 99

@credit to: http://www.cyberciti.biz/faq/iptables-delete-ip-address-subnet-from-linux-firewall/

Tips on changing file permissions in bulk.

First command – changes all directories under the current directory to 700 file mode.

find . -type d -exec chmod 0700 {} \;

Second command – changes all files under the current directory to 600 mode.

find . -type f -exec chmod 0600 {} \;