FTP介绍
FTP是FILE Transfer Protocol 文件传输协议,用于在Internet上控制文件的双向传输。
小公司用得多,大企业不用,因为它不安全。[en]Small companies use a lot, large enterprises do not use FTP, because it is not safe.
1、安装vsftpd
yum install -y vsftpd
2、创建一个普通的系统用户
useradd -s /sbin/nologin virftp
指定用户的外壳为NOLOGIN,不允许登录。[en]Specify that the user’s shell is nologin, and login is not allowed.
3、创建虚拟ftp用户配置文件
vi /etc/vsftpd/vsftpd_login
写下虚拟用户的用户名和密码:[en]Write the user name and password of the virtual user:
test1 奇数行 写用户名
123 偶数行 写密码
test2 多个用户就写多组,中间不能有空行和空格
456
更改权限[en]Change permissions
chmod 600 /etc/vsftpd/vsftpd_login
将文本文件转换为二进制文件[en]Convert text files to binary files
db_load -T -t hash -f /etc/vsftpd/vsftpd_login /etc/vsftpd/vsftpd_login.db
4、创建虚拟用户的配置文件目录
mkdir /etc/vsftpd/vsftpd_user_conf
cd /etc/vsftpd/vsftpd_user_conf
为虚拟用户创建配置文件:[en]Create a profile for the virtual user:
vim test1
此处的文件名必须和/etc/vsftpd/vsftpd_login文件里的用户名一致。
java;gutter:true;
local_root=/home/virftp/testuser1 定义虚拟用户的家目录
anonymous_enable=NO 不允许匿名用户登陆,如果允许则用YES
write_enable=YES 写权限,允许
local_umask=022 设定umask,用来控制用户创建文件和目录的默认权限</p>
<p>anon_upload_enable=NO 不允许匿名用户上传
anon_mkdir_write_enable=NO 不允许匿名用户创建目录和写权限
idle_session_timeout=600 空闲时限600秒,超时自动断开
data_connection_timeout=120 数据连接(请求)时限120秒,超时会自动断开
max_clients=10 客户端的最大连接数</p>
<pre><code>
5、创建虚拟ftp用户的家目录,并创建测试文件
;gutter:true;
mkdir /home/virftp/test1
touch /home/virftp/test1/1.txtx
修改权限Chown-R virftp:virftp/home/virftp[en]Modify permissions chown-R virftp:virftp / home/virftp
6、定义用户验证文件路径
vi /etc/pam.d/vsftpd 编辑ftp的用户认证文件
前面加:注意系统是32位还是64位[en]Add at the front: pay attention to whether the system is 32-bit or 64-bit
将密码身份验证表单指定为文件并指定路径路径[en]Specify the password authentication form as a file and specify the path path
auth sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
将账户存储表单指定为文件,并指定账户存储文件路径[en]Specify the account storage form as file, and specify the account storage file path
account sufficient /lib64/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
7、配置vsftp服务
vi /etc/vsftpd/vsftpd.conf
将anonymous_enable=YES 改为 anonymous_enable=NO 不允许匿名用户登录
将#anon_upload_enable=YES 改为 anon_upload_enable=NO 不允许匿名用户上传
将#anon_mkdir_write_enable=YES 改为 anon_mkdir_write_enable=NO 不允许匿名用户创建目录和写入
添加以下内容[en]Add the following
chroot_local_user=YES 允许切换到系统用户
guest_enable=YES 打开来宾用户
guest_username=virftp 定义来宾用户为virftp
virtual_use_local_privs=YES 允许虚拟用户映射到系统用户
user_config_dir=/etc/vsftpd/vsftpd_user_conf 定义用户配置文件目录
allow_writeable_chroot=YES 允许写权限
8、启动vsftpd服务
systemctl start vsftpd
9、使用客户端(FileZilla Client)连接
使用系统用户端口22登录到服务器[en]Log in to the server using the system user, port 22

参考: https://blog.csdn.net/langyue919/article/details/80796369
Original: https://www.cnblogs.com/linlf03/p/16105567.html
Author: work hard work smart
Title: ftp服务搭建
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/5933/
转载文章受原作者版权保护。转载请注明原作者出处!