# [Solved] vsftpd problems with virtual users

## nc3b

Hello. I am trying to setup a vsftpd server with virtual users, each user having a separate homedir. So I tried the pam_pwdfile section I had found http://gentoo-wiki.com/HOWTO_vsftpd So my vsftpd.conf is

```

listen=YES

anonymous_enable=NO

#local_enable=YES

dirmessage_enable=YES

write_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

ls_recurse_enable=YES

guest_username=ftp

chroot_local_user=YES

user_sub_token=$USER

```

And my /etc/pam.d/ftp is

```

auth    required /lib/security/pam_pwdfile.so pwdfile /etc/vsftpd/passwd_ftp

account required /lib/security/pam_permit.so

```

When I try to connect to the server it says

 *Quote:*   

> 500 OOPS: vsftpd: both local and anonymous access disabled!

 

Don't know what to do. Can anyone help me? Thank you.Last edited by nc3b on Sat Apr 26, 2008 1:22 pm; edited 1 time in total

----------

## yaneurabeya

Try username=ftp, i.e. ftp://ftp@your_host_addr/, and uncomment local_enable=YES to see whether or not you can connect locally with the ftp program.

----------

## nc3b

I can if I uncomment that I can connect with filezilla from windows without problems, but with real users. I am not interested on doing that. What I want to do is connect with virtual users.

----------

## nc3b

You were actually right  :Smile:  Many thanks. I now understand that you actually need local_enable=YES for virtual users, because they are eventually mapped to a real user:) Everything is fine now, and I actually have different homes for different users! Really nice  :Cool:  , take that 99999 guys who said "it can't be done with vsftpd, try pure-ftpd or proftpd"   :Rolling Eyes:  .

Here is my vsftpd.conf file:   :Very Happy: 

```

local_enable=YES

anonymous_enable=NO

write_enable=YES

local_umask=022

dirmessage_enable=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

chroot_local_user=YES

listen=YES

#pam_service_name=vsftpd

userlist_enable=YES

tcp_wrappers=YES

# Virtual users will be logged into /home/virtualftp/[username]/

user_sub_token=$USER

local_root=/home/virtualftp/$USER

guest_enable=YES

guest_username=virtualftp

# Umask applied for virtual users and anon

anon_umask=0022

# Allows uploading by virtual users

anon_upload_enable=YES

# Allows creation of directories by virtual users

anon_mkdir_write_enable=YES

# Allows deletion of files and directories by virtual users

anon_other_write_enable=YES

idle_session_timeout=600

```

And my /etc/pam.d/ftp file   :Smile: 

```

session optional pam_keyinit.so force revoke

auth    required /lib/security/pam_pwdfile.so pwdfile /etc/vsftpd/passwd_ftp

account required /lib/security/pam_permit.so

```

So it's basically a combination between http://gentoo-wiki.com/HOWTO_vsftpd and http://alien2thisworld.net/sitePages/tutorials/vsftpd_virtual_users_setup.html

The gentoo-wiki seems down at the moment, so I'm going to check the second site out, who knows what cool stuff might pe lurking there. Cheers   :Wink: 

----------

