工作需要前端工程师在测试环境测试,但是前端工程师大多不用Linux,调试起来我这种兼职运维的就是一个苦逼了,因此在Ubuntu下搭建一个FTP服务器方便前端工程师部署调试自己的代码。
搭建ProFTPd服务器
安装ProFTPd
sudo apt-get install proftpd
配置ProFTPd
vim /etc/proftpd/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 "HAO GEEK TEAM"
ServerIdent on "Welcome To Hao Geek!"
ServerType standalone
DefaultAddress 192.168.1.***
SocketBindTight 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 www-data
Group www-data
# To cause every FTP user to be "jailed" (chrooted) into their home
# directory, uncomment this line.
DefaultRoot /srv/www/test/
AllowOverwrite yes
# Normally, we want files to be overwriteable.
<Directory /srv/www/test/test1>
<Limit WRITE>
AllowUser wangzhengyi
DenyAll
</Limit>
</Directory>
# 设置客户端认证方式,通过文件认证
AuthOrder mod_auth_file.c mod_auth_unix.c
# 指定文件认证的passwd文件
AuthUserFile /etc/proftpd/ftp.passwd
# 指定文件认证的group文件
AuthGroupFile /etc/proftpd/ftp.group
# 认证帐号不需要有有效的shell
RequireValidShell off
# 设置每秒接受的连接请求个数,防止DoS攻击
MaxConnectionRate 5
# 最大的连接上的client的数量
MaxClients 20 "Sorry,the maximum number of allowed users (%m) are already connected. "
# 允许端点续传
AllowStoreRestart on
#关闭dns反向解析
UseReverseDNS off
IdentLookups off
ftpasswd创建访问用户
sudo ftpasswd --passwd --file=/etc/proftpd/ftp.passwd --name=wangzhengyi --uid=33 --shell=/bin/false --home=/home/nohome
每个参数的定义可以man一下,动动脑子想想自己的需求还是很必要的!
重启proftpd服务器
sudo /etc/init.d/proftpd restart