PDA

View Full Version : Fedora 9, vsftpd and virtual users.


Felarin
2008-05-24, 07:24 PM CDT
Hi all,

I'm facing an interesting problem.

I've setup vsftp, db_config and pam for use with virtual users.

This is my /etc/vsftpd.conf file.

anonymous_enable=NO
local_enable=YES
write_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtual
listen=YES
listen_port=19500
pasv_min_port=50000
pasv_max_port=50999
xferlog_enable=YES
dual_log_enable=YES
hide_ids=YES
use_localtime=YES
write_enable=NO
max_login_fails=5
anon_max_rate=10000
local_max_rate=10000
max_clients=6
max_per_ip=2
banner_file=/etc/vsftpd/banner
pam_service_name=vsftp

This is my pam vsftp file.

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

The /etc/vsftpd/vsftp_login location is valid, that's the db i created with db_config

[root@Ragnarok ~]# ls -l /etc/vsftpd/
total 36
-rw-r--r-- 1 root root 303 2008-05-24 10:30 banner
-rw------- 1 root root 125 2008-04-01 05:22 ftpusers
-rw------- 1 root root 361 2008-04-01 05:22 user_list
-rw------- 1 root root 538 2008-05-25 09:02 vsftpd.conf
-rwxr--r-- 1 root root 338 2008-04-01 05:22 vsftpd_conf_migrate.sh
-rw------- 1 root root 4474 2008-05-24 10:14 vsftpd.conf.old
-rw------- 1 root root 12288 2008-05-25 09:07 vsftp_login

It's been chmod with 600.

When i try to connect, it fails to allow my user to authenticate and this appears in /var/log/secure

user_lookup: could not open database `/etc/vsftpd/vsftp_login': No such file or directory

I suspect it's because of the ` and ' at the beginning and end of that path but that's not added in by me. Is this a bug?

dmbyer
2008-06-01, 07:42 AM CDT
vsftpd_login needs to be named vsftpd_login.db

The way you create your users list from a text file to a DB is with the following command which you must be root to execute:

db_load -T -t hash -f vsftp_login.txt /etc/ftpd/hash_vsftp_login.db


Change the file names as necessary. The first file name is your text file containing virtual users, the second is the name/location of the DB file you are converting to. Make sure to include the .db extension on the actual file name, but do not change your PAM or any other conf settings.

Enjoy!

nix4me
2008-06-01, 06:00 PM CDT
I know you are not using mysql, but you might consider it. It is very easy to setup and very easy to admin with phpmyadmin. Howtoforge has some great howto's on exactly how to set it up.

NeilEvan814
2008-06-02, 10:32 PM CDT
db_load is ancient ....Berkeley only offers a db4.2-util package right now which pam_userdb.so is unable to parse correctly from. You can use db3_load but as far as I can tell you need to compile this from source.
Neil