修改配置文件
vim /etc/vsftpd/vsftpd.conf
----------
# 在后面追加
# self add
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
tcp_wrappers=YES
listen_port=8021
port_enable=NO
pasv_enable=YES
pasv_min_port=8022
pasv_max_port=8025
local_root=/home
user_config_dir=/etc/vsftpd/userconfig
pasv_address=192.168.2.175
# pasv_addr_resolve=YES
# pasv_promiscuous=YES
设置登录用户
[root@88baa4f48b9c /]# cd /etc/vsftpd
[root@88baa4f48b9c vsftpd]# ls
ftpusers user_list vsftpd.conf vsftpd_conf_migrate.sh
- 在
/etc/vsftpd
目录下ftpusers
文件下记录者不许登录ftp的用户 user_list
文件中记录者可以登录ftp的用户
#
# When "listen" directive is enabled, vsftpd runs in standalone mode and
# listens on IPv4 sockets. This directive cannot be used in conjunction
# with the listen_ipv6 directive.
listen=YES
#
# This directive enables listening on IPv6 sockets. By default, listening
# on the IPv6 "any" address (::) will accept connections from both IPv6
# and IPv4 clients. It is not necessary to listen on *both* IPv4 and IPv6
# sockets. If you want that (perhaps because you want to listen on specific
# addresses) then you must run two copies of vsftpd with two configuration
# files.
# Make sure, that one of the listen options is commented !!
listen_ipv6=NO
pam_service_name=vsftpd
userlist_enable=YES
tcp_wrappers=YES
# self add
userlist_file=/etc/vsftpd/user_list
userlist_deny=NO
tcp_wrappers=YES
listen_port=8021
port_enable=NO
pasv_enable=YES
pasv_min_port=8022
pasv_max_port=8030
local_root=/home
user_config_dir=/etc/vsftpd/userconfig # 登录用于的信息设置
pasv_address=192.168.2.175
# pasv_addr_resolve=YES
# pasv_promiscuous=YES
添加的新用户
使用 adduser 命令
sudo adduser <username>
设置用户密码
无论你选择哪种方式创建用户,都可以使用 passwd 命令为用户设置密码:
sudo passwd <username>
在/etc/vsftpd//etc/vsftpd/userconfig
文件中添加用户名
设置用户的查看权限
user_config_dir=/etc/vsftpd/userconfig
,这个设置是设置用户的权限
在/etc/vsftpd/userconfig
目录下创建一个名字与用户名相同的文件,
然后编辑文件如果写入local_root=/home/aaa_ftp
,表示用户可以查看/home/aaa_ftp这个目录下的文件