linux shell pptpd

简介:

 #!/bin/bash

yum -y install wget
wget http://sourceforge.net/projects/poptop/files/pptpd/pptpd-1.3.4/pptpd-1.3.4.tar.gz/
dir=/usr/src/local
IP=`ifconfig | awk '{print $2}' | grep  'addr:' | cut -d ':' -f2 | grep -v '127.0.0.1' | sed '/^$/d'`
if [ -d "$dir" ];then
tar zxvf pptpd-1.3.4.tar.gz -C  $dir                               ##The path make sure have pptpd tar##
else
mkdir -p $dir
tar zxvf pptpd-1.3.4.tar.gz -C $dir
fi
cd $dir/pptpd-1.3.4/
echo "#####pptpd configure-- make-- make install####"
yum -y install gcc
./configure  --prefix=/usr/local/pptpd  --enable-bcrelay  --with-libwrap && make && make install && echo "====ok====="
mkdir -p /usr/local/pptpd/etc/ppp
##copy pptpd configuration file##
cp $dir/pptpd-1.3.4/samples/pptpd.conf   /usr/local/pptpd/etc/ 
cp $dir/pptpd-1.3.4/samples/options.pptpd /usr/local/pptpd/etc
cp $dir/pptpd-1.3.4/samples/chap-secrets /usr/local/pptpd/etc/ppp
CONF=/usr/local/pptpd/etc/pptpd.conf
##Modify the pptpd.conf file
sed -i '/option/s/\/etc\/ppp/\/usr\/local\/pptpd\/etc/g' $CONF    ##this sed command "/etc/ppp"---to---> "/usr/local/pptpd/etc"
sed -i 's/#debug/debug/g' $CONF                                   ##Remove the debug annotation
sed -i '$a stimeout 30\nremoteip 192.168.10.100-120\n' $CONF      ##(the same as) echo "stimeout 30\nremoteip 192.168.10.100-120\n" >> $CONF
echo "localip  $IP" >> $CONF
##Modify the options.pptpd file
echo "debug" >> /usr/local/pptpd/etc/options.pptpd 
sed -i '$a ms-dns 8.8.8.8' /usr/local/pptpd/etc/options.pptpd
##Set the account(loginuser) and password
cat >> /usr/local/pptpd/etc/ppp/chap-secrets << EOF
admin       pptpd     admin123         192.168.10.100
tom         pptpd     tom123                *
EOF
##Open the routing forwarding##
sed -i '/net.ipv4.ip_forward/s/0/1/g' /etc/sysctl.conf
sysctl -p
##
/usr/local/pptpd/sbin/pptpd -c /usr/local/pptpd/etc/pptpd.conf -o /usr/local/pptpd/etc/options.pptpd









本文转自 jie783213507 51CTO博客,原文链接:http://blog.51cto.com/litaotao/1186943,如需转载请自行联系原作者
目录
相关文章
|
11天前
|
Web App开发 Java Linux
Linux之Shell基本命令篇
Linux之Shell基本命令篇
Linux之Shell基本命令篇
|
28天前
|
安全 Shell Linux
【Shell 命令集合 系统管理 】Linux 锁定终端 vlock命令 使用指南
【Shell 命令集合 系统管理 】Linux 锁定终端 vlock命令 使用指南
35 1
|
28天前
|
监控 Shell Linux
【Shell 命令集合 系统管理 】Linux 显示当前登录到系统的用户信息 who命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示当前登录到系统的用户信息 who命令 使用指南
43 1
|
28天前
|
监控 Shell Linux
【Shell 命令集合 系统管理 】Linux 显示目前登入系统的用户信息 w命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示目前登入系统的用户信息 w命令 使用指南
43 2
|
28天前
|
存储 Shell Linux
【Shell 命令集合 系统管理 】Linux 修改用户的属性和配置 usermod命令 使用指南
【Shell 命令集合 系统管理 】Linux 修改用户的属性和配置 usermod命令 使用指南
30 1
|
12天前
|
Shell Linux
【Linux】12. 模拟实现shell
【Linux】12. 模拟实现shell
27 2
|
25天前
|
存储 算法 Shell
【Linux 环境变量相关】深入理解Linux下 CMake、Shell 与环境变量的交互(二)
【Linux 环境变量相关】深入理解Linux下 CMake、Shell 与环境变量的交互
44 0
|
25天前
|
Shell Linux 开发工具
shell的介绍以及Linux权限的讲解
shell的介绍以及Linux权限的讲解
31 2
|
28天前
|
网络协议 Shell Linux
【Shell 命令集合 系统管理 】Linux 查询域名的注册信息 whois命令 使用指南
【Shell 命令集合 系统管理 】Linux 查询域名的注册信息 whois命令 使用指南
46 1
|
28天前
|
存储 Shell Linux
【Shell 命令集合 系统管理 】Linux 显示当前登录用户的用户 whoami命令 使用指南
【Shell 命令集合 系统管理 】Linux 显示当前登录用户的用户 whoami命令 使用指南
43 1