在Ubuntu Server部署FTP服务
部署FTP
1. 安装VSFTP
sudo apt install vsftpd
2. 查看服务是否运行
sudo systemctl status vsftpd.service
成功会有以下输出
Active: active (running)
3. 配置VSFTP
打开配置文件
sudo nano /etc/vsftpd.conf
启用FTP上传命令
#Uncomment this to enable any form of FTP write command.write_enable=YES
限制用户访问的目录
#You may restrict local users to their home directories. See the FAQ for
#the possible risks in this before using chroot_local_user or
#chroot_list_enable below.chroot_local_user=YES
设置用户根目录
user_sub_token=$USER
local_root=/home/$USER/ftp
FTP用户访问控制(白名单)
userlist_enable=YES
userlist_file=/etc/vsftpd.userlist
userlist_deny=NO
更改FTP用户创建文件的权限
https://www.cnblogs.com/tohilary/p/3732881.html
# Default umask for local users is 077. You may wish to change this to 022,
# if your users expect that (022 is used by most other ftpd's)local_umask=022
4. 为FTP增加一个用户
sudo adduser <ftp user name>
5. 创建FTP文件目录
sudo mkdir <ftp directory>
修改目录所有权
sudo chown <ftp user name> <ftp directory>
相关命令
用途 | 命令 |
---|---|
查看当前用户所在组 | groups |
查看某用户的用户组 | groups <user name> |
删除用户的所在组 | deluser <user name> <group name> |
更改目录的所在组 | chgrp <group name> <directory> |
6. 用客户端登录
当前会被客户端提示为不安全连接