Proftpd 配置安装

一、安装proftpd软件 http://www.proftpd.org下载下来的是一个压缩包

tar zxvf proftpd-1.3.1.tar.gz 进行解压
cd proftpd-1.3.1 进入文件夹

./configure --prefix=/etc/proftpd 把proftpd-1.3.1安装到/etc/proftpd文件夹下
make
make install

make clean

二、新建用户
groupadd proftp 创建一个proftp组

useradd -g proftp -d /var/ftp/yatan -s /sbin/nologin yatan 这句话我的理解是(新建 yatan用户,并把它加入proftp组,把yatan的目录建在/var/ftp目录下,并指定它的shell为nologin,这个nologin 并不能让yatan用户进入linux系统

passwd yatan 设置yatan的密码

好了,用户设置好了 : )

三、在开始配置proftpd.conf文件之前进行以下操作:
1、因为我用的是红帽子as4.0的,所以先要把自带的vsftpd给停掉
service vsftpd stop 或者直接 rpm –e vsftpd

2、设置一个proftpd的启动服务
编辑一个启动脚本,
cd proftpd-1.3.1 进入proftpd-1.3.1的解压文件夹中
cp contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd 拷贝proftpd.init.d到/etc/rc.d/init.d文件夹中,并改名为proftpd
vi /etc/rc.d/init.d/proftpd 编辑这个文件,找到文件中有一行是PATH行,将它改成你所安装proftpd所在的目录。
PATH="$PATH:/etc/proftpd/sbin:/etc/proftpd/bin" 我是安装在/etc/proftpd文件下,保存退出
3、把/etc/rc.d/init.d/proftpd设成可执行文件
chmod +x /etc/rc.d/init.d/proftpd

# 然后运行命令:
[root@localhost /]# chkconfig --level 35 proftpd on

# 则下次系统启动以后,proftpd将自动启动。

chkonfig –add proftpd
这样就可以用service proftpd start和service proftpd stop 和service proftpd restart来分别执行开启服务,停止服务与重启服务

差点忘了要改配置文件了,嘻
vi /etc/proftpd/etc/proftpd.conf
在全局配置里把group的值为nogroup改成nobody
好了,配置前的工作做好了

四、现在正式来配置proftpd.conf里的权限设置,
vi /etc/proftpd/etc/proftpd.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 "ProFTPD Default Installation"
ServerType standalone
DefaultServer on

# Port 21 is the standard FTP port.
Port 21

# 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 (这边就是我在上一步所讲的设置成nobody)

# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~(阻止用户到其他目录,它们只能呆在自家目录)

# Normally, we want files to be overwriteable.
AllowOverwrite on

# Bar use of SITE CHMOD by default
<Limit SITE_CHMOD>;
DenyAll
</Limit>;

# 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
DisplayFirstChdir .message

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

<Directory />
AllowOverwrite on
AllowStoreRestart on
#AllowForeignAddress on
<Limit All>
AllowAll
</Limit>
</Directory>

<Directory /var/ftp/yatan>
<Limit DELE RNFR RNTO RMD XRMD>
DenyUser yatan
</Limit>
</Directory> (这几句是对yatan用户的权限限制,只允许它对/var/ftp/yatan有写的权限,不允许它有DELE RNFR RNTO RMD XRMD的权限)

存盘退出
service proftpd restart

五、修改一下/var/ftp目录的权限
chmod –R 775 /var/ftp 
这样tc对/var/ftp/skate的文件具有写,删,改,执行的所有权限。

 

 

http://www.yatan.com/group/topic.php?tid=21356

你可能感兴趣的:(工作,linux,PHP,dos,脚本)