Ftp – VSFTPD Virtual (Guest) Users with @ in username

ftp

I've setup VSFTPD so when a user connects it'll use a user_config_dir search for that connected user and setup a chroot guest session (since there are multiple FTP accounts belonging to multiple users on the server). This works fine with user names that have no special characters. To avoid collisions on usernames I'm setting up each username with a postfix '@domain.tld' – however, the custom rules in user_config_dir don't load when the user has an @ symbol in the name. Is there a way around this in VSFTPD – or a setting that needs to be switched?

vsftpd.conf

listen=YES
anonymous_enable=NO
local_enable=YES
guest_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
chroot_local_users=YES
pam_service_name=scftp
user_config_dir=/etc/vsftpd/virtual

pam.d/scftp

auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login

vitrtual/usernamewithoutspecialchars

write_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
local_root=/home/marco
chroot_local_user=YES
dirlist_enable=YES
download_enable=YES
guest_username=marco

virtual/user@domain.tld

write_enable=YES
anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
local_root=/home/marco
chroot_local_user=YES
dirlist_enable=YES
download_enable=YES
guest_username=marco

It really just seems it won't match the FTP user user@domain.tld to the proper virtual file – while usernamewithoutspecialchars works just fine.

Best Answer

Linux filesystems can quite happily manage @ in the name of a directory so the problem you are seeing most likely is with vsftpd. Have you tried using user.domain.tld in stead of user@domain.tld?