proftpd的安装脚本

[不指定 2010/09/02 10:16 | by admin ]
| |
本内容为原创内容,转载请注明:
本文来自http://blog.gsywx.com

程序可以从官方下载
下载地址:
http://www.proftpd.org/
默认约定:
程序安装位置为 :/web/proftpd
创建用户为     :www
www家目录为    :/home/wwwroot/htdocs
www密码在安装过程中手工输入
脚本代码如下:


#!/bin/bash
clear
echo "----------------proftpd安装程序,按任意键继续---------------"  
get_char()
  {
  SAVEDSTTY=`stty -g`
  stty -echo
  stty cbreak
  dd if=/dev/tty bs=1 count=1 2> /dev/null
  stty -raw
  stty echo
  stty $SAVEDSTTY
  }
  echo ""
  char=`get_char`

wget ftp://ftp.proftpd.org/distrib/source/proftpd-1.3.3a.tar.gz
tar zxvf proftpd-1.3.3a.tar.gz
cd proftpd-1.3.3a
./configure --prefix=/web/proftpd
make
make install

mkdir -p /home/wwwroot/htdocs
groupadd www
useradd www -g www -d /home/wwwroot/htdocs -s /sbin/nologin
echo "Please input new password for user: www"
passwd www
chown -R www.www /home/wwwroot/htdocs

cp contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
sed -i 's\PATH="$PATH:/usr/local/sbin"\PATH="$PATH:/web/proftpd/sbin"\g' /etc/rc.d/init.d/proftpd
chmod +x /etc/rc.d/init.d/proftpd
chkconfig --add proftpd
chkconfig proftpd on
cd ../
mv /web/proftpd/etc/proftpd.conf /web/proftpd/etc/proftpd.conf.bak
cp proftpd.conf /web/proftpd/etc/
service proftpd start

echo "删除安装临时文件.............."
rm -Rf proftpd-1.3.3a
echo
echo
echo " ------------------- 如需增加新用户,请使用以下命令 -------------------"
echo "|      useradd 用户名 -g 用户组 -d 用户家目录 -s /sbin/nologin         |"
echo " -------------------------- proftpd 安装结束! -------------------------"
echo
echo
echo
echo


安装过程中的proftpd.conf为直接拷贝,请先行在安装目录创建profptd.conf,代码如下:
# This is a basic ProFTPD configuration file (rename it to
# 'proftpd.conf' for actual use.  It establishes a single server
# and a single anonymous login.  It assumes that you have a user/group
# "nobody" and "ftp" for normal operation and anon.

ServerName      "Welcome to my Proftpd"
ServerType      standalone
DefaultServer      on

# Port 21 is the standard FTP port.
Port        21

# Don't use IPv6 support by default.
UseIPv6        off

# Umask 022 is a good standard umask to prevent new dirs and files
# from being group and world writable.
Umask        022

# To prevent DoS attacks, set the maximum number of child processes
# to 30.  If you need to allow more than 30 concurrent connections
# at once, simply increase this value.  Note that this ONLY works
# in standalone mode, in inetd mode you should use an inetd server
# that allows you to limit maximum number of processes per service
# (such as xinetd).
MaxInstances      30

# Set the user and group under which the server will run.
User        nobody  
Group        nobody

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
#欢迎登录 ProFTPD
DefaultRoot ~

# Normally, we want files to be overwriteable.
#允许被写入覆盖
AllowOverwrite    on
#下载允许断点续传
AllowRetrieveRestart   on
#上传允许断点续传
AllowStoreRestart      on
UseReverseDNS off
IdentLookups off
#设置ftp登陆欢迎信息文件
#DisplayLogin welcome.msg
#屏蔽服务器版本信息
#ServerIdent off

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>
  DenyAll
</Limit>
#以上为全局配置

#以下为具体目录权限配置
<Directory /home/wwwroot/htdocs/>
<Limit SITE_CHMOD>
AllowAll
</Limit>
  AllowRetrieveRestart   on
  AllowOverwrite        on
  AllowStoreRestart   on
</Directory>

# A basic anonymous configuration, no upload directories.  If you do not
# want anonymous users, simply delete this entire <Anonymous> section.
#<Anonymous ~ftp>
#  User        ftp
#  Group        ftp

  # We want clients to be able to login with "anonymous" as well as "ftp"
#  UserAlias      anonymous ftp

  # Limit the maximum number of anonymous logins
#  MaxClients      10

  # We want 'welcome.msg' displayed at login, and '.message' displayed
  # in each newly chdired directory.
#  DisplayLogin      welcome.msg
#  DisplayChdir      .message

  # Limit WRITE everywhere in the anonymous chroot
#  <Limit WRITE>
#    DenyAll
#  </Limit>
#</Anonymous>

电脑类 | 评论(0) | 引用(0) | 阅读(439)