CentOS 5.5 编译安装配置proftpd
时间:2010-06-16 来源:icehsea
[root@localhost Desktop]# tar jxvf proftpd-1.3.3.tar.bz2
[root@localhost Desktop]# cd proftpd-1.3.3
[root@localhost proftpd-1.3.3]# ./configure
[root@localhost proftpd-1.3.3]# make
[root@localhost proftpd-1.3.3]# make install
安装顺利完成~~ 二、配置 1、设置用户及其目录[root@localhost proftpd-1.3.3]# groupadd ftpuser
//增加一个组ftpuser[root@localhost proftpd-1.3.3]# useradd -d /software -g ftpuser –s /sbin/nologin software
[root@localhost proftpd-1.3.3]# passwd software
Password:software 增加一个用户software,属于ftpuser,文件夹为/software[root@localhost proftpd-1.3.3]# useradd -d /www -g ftpuser -s /sbin/nologin www
[root@localhost proftpd-1.3.3]# passwd www
Password:webuser 增加一个用户www,属于ftpuser,文件夹为/www[root@localhost /]# ls -l
总计 162drwxr-xr-x 2 root root 4096 06-15 01:27 bin
drwxr-xr-x 4 root root 1024 06-15 15:41 boot
drwxr-xr-x 12 root root 4020 06-15 15:54 dev
drwxr-xr-x 101 root root 12288 06-15 16:14 etc
drwxr-xr-x 3 root root 4096 06-15 06:42 home
drwxr-xr-x 13 root root 12288 06-15 01:26 lib
drwx------ 2 root root 16384 06-15 06:18 lost+found
drwxr-xr-x 3 root root 4096 06-15 15:55 media
drwxr-xr-x 2 root root 0 06-15 15:54 misc
drwxr-xr-x 3 root root 4096 2010-06-15 mnt
drwxr-xr-x 2 root root 0 06-15 15:54 net
drwxr-xr-x 2 root root 4096 06-15 02:49 opt
dr-xr-xr-x 155 root root 0 06-15 15:52 proc
drwxr-x--- 18 root root 4096 06-15 16:19 root
drwxr-xr-x 2 root root 12288 06-15 01:27 sbin
drwxr-xr-x 4 root root 0 06-15 15:52 selinux
drwx------ 3 software ftpuser 4096 06-15 16:12 softwaredrwxr-xr-x 2 root root 4096 01-27 05:43 srv
drwxr-xr-x 11 root root 0 06-15 15:52 sys
drwxrwxrwt 18 root root 4096 06-15 16:19 tmp
drwxr-xr-x 14 root root 4096 06-15 06:21 usr
drwxr-xr-x 22 root root 4096 06-15 06:28 var
drwx------ 3 www ftpuser 4096 06-15 16:14 www
这两个文件夹已经有了,并且已经属于相应的组了,接下来就要为其设置属性[root@localhost /]# chmod -R 755 /software
ftp软件目录权限为755,ftpuser对其有读、写、执行权力,其他用户只有读和执行权力[root@localhost /]# chmod -R 777 /www
网站目录一般设为777, 一时找不到配置了,找一下[root@localhost /]# updatedb
[root@localhost /]# locate proftpd.conf
/usr/local/etc/proftpd.conf[root@localhost proftpd-1.3.3]# cd /usr/local/etc/
[root@localhost etc]# ls
proftpd.conf[root@localhost etc]# cp proftpd.conf proftpd.conf.save
[root@localhost etc]# vi proftpd.conf
开始编辑配置文件 2、配置文件# 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 test #这里可以改服务器名字 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 #此处一定要改为Group nobody ,否则无法启动# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot ~ ftpuser
#限制ftpuser在其目录里,要去掉前面的#DelayEngine off
IdentLookups off
#在使用者登入时反查对方的DNS记录。UseReverseDNS off
#在使用者登入时反查对方的DNS记录。 关掉这三项可以加快速度# Normally, we want files to be overwriteable.
AllowOverwrite onAllowRetrieveRestart on # 下载时,允许断点续传
AllowStoreRestart 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 匿名用户即为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><Limit LOGIN>
DenyALLAllowGroup ftpuser
</Limit> #设置只有ftpusers组的用户可以ftp登录<Directory /www>
<Limit ALL>
AllowUser web
</Limit> </Directory># 设置帐号websoul拥有/www目录的所有权限
<Directory /software>
<Limit ALL>
AllowUser software
</Limit> </Directory># 设置帐号softsoul拥有/software目录的所有权限
# ServerIdent off # 屏蔽服务器版本信息
MaxLoginAttempts 6 # 最大连接次数
WtmpLog on # 是否要把ftp记录在日志中,如果不想可以设置成off屏蔽掉log日志。
TimeoutIdle 600 # 客户端idel时间设置,默认就是600秒
AllowForeignAddress on #支持FXP
[root@localhost /]# ln –s /usr/local/etc/proftpd.conf /etc/proftpd.conf
为方便下次寻找,设置下连接 3、加入服务 每次修改配置文件后要重启服务才能生效,所以将其加入服务 以下代码将proftpd加入服务中[root@localhost proftpd-1.3.3]## cp ./contrib/dist/rpm/proftpd.init.d /etc/rc.d/init.d/proftpd
#直接运行权限不够,增加可运行属性[root@localhost proftpd-1.3.3]# chmod +x /etc/rc.d/init.d/proftpd
[root@localhost proftpd-1.3.3]# /etc/rc.d/init.d/proftpd start
#会有ok提示[root@localhost proftpd-1.3.3]# /etc/rc.d/init.d/proftpd stop
以下两条命令也是同样的效果[root@localhost proftpd-1.3.3]# service proftpd start
[root@localhost proftpd-1.3.3]# service proftpd stop
#用ps-ax|grep proftpd查找,无proftpd进程。 4、设置自启动[root@localhost proftpd-1.3.3]# vi /etc/rc.local
加入/usr/local/sbin/proftpd 5、服务器IP设置 为了以后方便访问,要将CentOS设成固定IP IP:192.168.65.132 根据自己vmware里的设置更改,我是用的NAT方式 Mask:255.255.255.0 Gateway:192.168.65.2 DNS与主机相同就行,也可自行更改[root@localhost proftpd-1.3.3]# service network restart
试了一下,可以上网三、访问 1、本机访问 在CentOS中127.0.0.1或者192.168.65.132都可以 打开防火墙 2、内网中访问 在xp中,使用192.168.5.132访问,下载上传文件也没有问题
3、外网访问 如果外网需要访问,在vmware中增加端口映射, 访问是设置IP为主机IP,端口为自己设定的端口,我这边是2121,测试也成功 参考资料: http://itbkb.cn/article.asp?id=79 http://www.cnblogs.com/riky/archive/2007/04/24/725329.html