RedHat AS 4.0 下proftpd服务器的架设
架设服务器要求:
1. 匿名用户可以访问。
2. Student用户有上传文件功能,没有删除权限
3. Teacher用户是ftp服务器管理员。
首先从www.proftpd.org下载proftpd的源程序。
用wget 下载,这个不用说了。
将下载的文件包放到/home/andy7/soft下,当然也可以放到别的地方。
tar zxvf proftpd-1.2.10.tar.gz
cd proftpd-1.2.10 进到解压的文件里。
./configure –prefix=/etc/proftpd 将我的proftpd安装到这个位置。
Make
Make install
注意在安装的时候,要保证你的linux下gcc已经安装。
这个需要个几分钟。
OK!
下面来设置两个用户:student 和 teacher
groupadd student
useradd student –g student –d /var/ftp/student –s /sbin/nologin 当然你得在/var下建立ftp目录
passwd student 下面给student设置权限。
Useradd –d /var/ftp teacher
Passwd teacher 下面给teacher设置权限
Gpasswd –a student teacher
Gpasswd –a teacher student
Chown teacher.teacher /var/ftp
Chmod –r 770 student
Chmod –r 775 ftp
我们这个时候到vi /etc/proftpd/etc/proftpd.conf 里把group的值为nogroup改成nobody
OK!
我们在到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 ~ skate,skate (阻止skate组的用户到其他目录,它们只能呆在自家目录)
# 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/skate>;
<Limit DELE RNFR RNTO RMD XRMD>;
DenyUser skate
</Limit>;
</Directory>; (这几句是对skate用户的权限限制,只允许它对/var/ftp/skate有写的权限,不允许它有DELE RNFR RNTO RMD XRMD的权限)
<Directory /var/ftp>;
<Limit CMD MKD RNFR DELE RMD RETR STOR READ WRITE DIRS NLST >;
AllowUser tc
</Limit>;
</Directory>;
好了
试看看吧
提醒:
在配置是要保证你的ip和计算机名要对应起来
不然启动的时候会报错的。
西电瑞德教育●Andy7
QQ:150661538 Email:debuglinux@gmail.com
2005-12-9