wiki'd

by JoKeru

Vsftpd with Virtual Users

[cc lang="bash"]
\$ yum install vsftpd db4-utils

\$ cd /etc/vsftpd/
\$ echo -e "user_name\npass_word" > virtual-users.txt
\$ db_load -T -t hash -f virtual-users.txt /etc/vsftpd/virtual-users.db
\$ chmod 600 virtual-users.*
\$ vi vsftpd.conf

\$ vi /etc/pam.d/vsftpd-virtual

\$ chown -R apache:apache /var/www/html/*
\$ service vsftpd restart
\$ chkconfig --levels 235 vsftpd on
[/cc]

/etc/vsftpd/vsftpd.conf
[cc lang="bash"]
# run in standalone mode
listen=YES
# bind server to ip
listen_address=10.20.30.40

# disables anonymous FTP
anonymous_enable=NO
# enables non-anonymous FTP
local_enable=YES
# activates virtual users
guest_enable=YES
# the real username which guest users are mapped to
guest_username=apache
# virtual users to use local privs, not anon privs
virtual_use_local_privs=YES
# the home directory for each virtual user
#local_root=/var/www/html
# or
user_sub_token=\$USER
local_root=/var/www/html/\$USER
# the virtual user is restricted to the virtual FTP area
chroot_local_user=YES
# enables uploads and new directories
write_enable=YES
# the PAM file used by authentication of virtual uses
pam_service_name=vsftpd-virtual
# hides the FTP server user IDs and just display "ftp" in directory listings
hide_ids=YES
# the umask for file creation
local_umask=077
[/cc]

/etc/pam.d/vsftpd-virtual
[cc lang="bash"]
#%PAM-1.0
auth required pam_userdb.so db=/etc/vsftpd/virtual-users
account required pam_userdb.so db=/etc/vsftpd/virtual-users
session required pam_loginuid.so
[/cc]

Comments