当前位置: 首页 > 工具软件 > Proftpd > 使用案例 >

linux下ftp管控,proftpd使用

薛烨霖
2023-12-01

linux下ftp管控proftpd使用


1、安装:源码地址:http://www.proftpd.org/
下载完毕后编译安装:

tar -zxvf proftpd-1.3.8.tar.gz
cd proftpd-1.3.8

./configure --enable-nls --prefix=/usr/local/proftpd #(其中nls是mod_lang,文档:http://www.proftpd.org/docs/modules/mod_lang.html )
make
make install

编译安装完成后会在/usr/local/proftpd的目录下会生成配置文件目录以及相应服务的二进制可执行文件
2、配置:

cd /usr/local/proftpd
先进入到usr/local/proftpd/passwd

添加虚拟Ftp账户

./ftpasswd --passwd --name=ftpxiyang --uid=201 --gid=201 --home=/home/ftp --shell=/sbin/nologin --file=/usr/local/proftpd/etc/passwd

修改刚创建的ftp账户家目录
chmod 777 /home/ftp
修改配置文件
vim /usr/local/proftpd/etc

-r--r----- 1 root root   78 8月  18 14:22 passwd
-rw-r--r-- 1 root root 2186 8月  18 14:32 proftpd.conf
-rw-r--r-- 1 root root 2172 8月  18 14:26 proftpd.conf~
[root@train etc]# pwd
/usr/local/proftpd/etc
[root@train etc]# vim proftpd.conf
 24 # that allows you to limit maximum number of processes per service
 25 # (such as xinetd).
 26 MaxInstances                    30
 27
 28 # Set the user and group under which the server will run.
 29 User                            nobody
 30 Group                           nobody
 31
 32 # To cause every FTP user to be "jailed" (chrooted) into their home
 33 # directory, uncomment this line.
 34 #DefaultRoot ~
 35
 36 # Normally, we want files to be overwriteable.
 37 AllowOverwrite          on
 38
 39 # Bar use of SITE CHMOD by default
 40 <Limit SITE_CHMOD>
 41   DenyAll
 42 </Limit>
 43
 44 # A basic anonymous configuration, no upload directories.  If you do not
 45 # want anonymous users, simply delete this entire <Anonymous> section.
 46 <Anonymous ~ftp>
 47   User                          ftp
 48   Group                         ftp
 49
 50   # We want clients to be able to login with "anonymous" as well as "ftp"
 51   UserAlias                     anonymous ftp
 52
 53   # Limit the maximum number of anonymous logins
 54   MaxClients                    10
 55
 56   # We want 'welcome.msg' displayed at login, and '.message' displayed
 57   # in each newly chdired directory.
 58   DisplayLogin                  welcome.msg
 59   DisplayChdir                  .message
 60
 61   # Limit WRITE everywhere in the anonymous chroot
 62   <Limit WRITE>
 63     DenyAll
 64   </Limit>
 65 </Anonymous>
 66 RequireValidShell off
 67 AuthUserFile /usr/local/proftpd/etc/passwd
 68
 69 <Limit LOGIN>
 70   AllowUser ftpxiyang
 71   DenyALL
 72  </Limit>
 73
 74 <Directory "/home/ftp">
 75 <Limit RMD DELE RETR RNTO>     #不允许重命名;删除文件、文件夹;下载
 76 DenyUser ftpxiyang
 77 </Limit>
 78 </Directory>
 79
cd /usr/local/proftpd
./sbin/proftpd

没有报错,说明开启成功,此时可以使用命令:
lsof -i :21 #FTP端口号
lsof -p (pid)##根据pid查找出进程树。

 类似资料: