FTP软件用于客户端和服务器之间传输文件。ProFTPd是一款常用的FTP软件,这篇帮助讲解如何在CentOS云服务器上安装和使用ProFTPd的操作方法。
执行以下命令安装ProFTPd软件。
sudo yum install epel-release
sudo yum install proftpd
sudo yum install ftp
编辑ProFTPd的配置文件。
sudo nano /etc/proftpd.conf
内容如下。
The file will resemble the following text.
# This is the ProFTPD configuration file
#
# See: http://www.proftpd.org/docs/directives/linked/by-name.html
# Server Config - config used for anything outside a <VirtualHost> or <Global> $
# See: http://www.proftpd.org/docs/howto/Vhost.html
ServerName "ProFTPD server"
ServerIdent on "FTP Server ready."
ServerAdmin root@localhost
DefaultServer on
# Cause every FTP user except adm to be chrooted into their home directory
# Aliasing /etc/security/pam_env.conf into the chroot allows pam_env to
# work at session-end time (http://bugzilla.redhat.com/477120)
VRootEngine on
DefaultRoot ~ !adm
VRootAlias /etc/security/pam_env.conf etc/security/pam_env$
# Use pam to authenticate (default) and be authoritative
AuthPAMConfig proftpd
AuthOrder mod_auth_pam.c* mod_auth_unix.c
# If you use NIS/YP/LDAP you may need to disable PersistentPasswd
#PersistentPasswd off
# Don't do reverse DNS lookups (hangs on DNS problems)
UseReverseDNS off
# Set the user and group that the server runs as
User nobody
Group nobody
# To prevent DoS attacks, set the maximum number of child processes
# to 20. If you need to allow more than 20 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 20
添加FTP用户并设置密码,以myuser为例。
useradd --shell /bin/false myuser
passwd myuser
创建用户目录并设置所有者权限。
mkdir /home/myuser
chown myuser:myuser /home/myuser/
最后用FTP客户端测试能否正常上传和下载文件。可以使用ftpwho命令显示目前所有FTP登录的用户信息。