I know this question has been answered few times, but I tried everything, and it still not working.
I tried to create user and chroot them to a specific folder, but after ftp, I was able to go up the tree and see for example the '/' folder and its content.
I am not trying to use 'virtual users' with PAM, but current issue is 'Authentication failed'.
/etc/vsftpd.conf
listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
xferlog_file=/var/log/vsftpd.log
secure_chroot_dir=/var/run/vsftpd/empty
ssl_enable=YES
allow_anon_ssl=NO
ssl_tlsv1=YES
ssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
user_sub_token=$USER
local_root=/home/bgftp/ftp/$USER
pasv_enable=Yes
pasv_min_port=40000
pasv_max_port=50000
chroot_list_enable=yes
pasv_address=[ip]
chroot_local_user=YES
hide_ids=YES
allow_writeable_chroot=YES
user_config_dir=/etc/vsftpd_user_conf
guest_enable=YES
virtual_use_local_privs=YES
pam_service_name=vsftpd
nopriv_user=vsftpd
guest_username=vsftpd
virtual_use_local_privs=YES
vsftpd: version 3.0.3 ubuntu: 18.04
/etc/pam.d/vsftpd
auth required pam_pwdfile.so pwdfile /etc/vsftpd/ftpd.passwd crypt=2
account required pam_permit.so crypt=2
/etc/vsftpd/ftpd.passwd is in the format user:hash
the hash was created using openssl passwd -1
and I manually copied the result.
the user1 folder exists:
/home/bgftp/ftp/user1# cat /etc/vsftpd_user_conf/user1
local_root=/home/bgftp/ftp/user1/folder1
current response:
Status: Connecting to [ip]...
Response: fzSftp started, protocol_version=2
Command: open "user1@[ip]" 22
Command: Trust new Hostkey: Once
Command: Pass: ******
Error: Authentication failed.
Error: Critical error: Could not connect to server
If you need more info, just let me know