基于VSFTP和openLDAP的虚拟用户主目录

我有一个基于CentOS 6的VSFTPD服务器,configuration为通过openLDAP服务器validation虚拟用户。 我可以login到FTP服务器,但是,通过身份validation的用户不会redirect到他们的主目录,而是到VSFTPD的主目录!

请注意,每个用户的主目录位于一个伪随机位置,因此,我不能使用类似的属性

user_config_dir=$USER 

但是,在LDAP中,属性homeDirectory包含用户主目录的完整path 。 例:

  uid:[email protected] homeDirectory: /nfs/{RANDOM_storage_location}/{RANDOM_NUMBER}/{DOMAIN}u/s/e/usertest 

我如何configurationvsftpd来使用每个用户的主目录?

configuration文件:

 ##Filename: pam_ldap.conf base dc=example,dc=com uri ldap://192.168.1.8:389 binddn cn=ftp,ou=read,ou=groups,dc=example,dc=com bindpw secret bind_timelimit 300 idle_timelimit 300 timelimit 300 

VSFTPD conf是:

 Anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 dirmessage_enable=YES # Enable Virtual users guest_enable=YES virtual_use_local_privs=YES chroot_local_user=YES chroot_list_enable=NO xferlog_enable=YES log_ftp_protocol=YES connect_from_port_20=YES listen=YES pam_service_name=vsftpd userlist_enable=YES tcp_wrappers=YES hide_ids=YES 

连接示例:

 ftp ftp> o 192.168.1.10 Connected to 192.168.1.10. 220- 220 Name (192.168.1.10:user): [email protected] 331 Please specify the password. Password: 230 Login successful. Remote system type is UNIX. ftp> dir Using binary mode to transfer files. 229 Entering Extended Passive Mode (|||21725|). 150 Here comes the directory listing. drwxr-xr-x 2 ftp ftp 4096 Feb 21 09:01 pub 226 Directory send OK.