File based virtual user settings for Vsftpd on FreeBSD

Sunday, March 16th, 2008

I’ve done this before with the help of a very good blog entry. But when I tried to do the same thing today I can’t find that page. So I decide to write this down, in case I’ll need it later.

The most problem of setting up Vsftpd with file based virtual user on FreeBSD is that we don’t have pam_userdb. So we’ll use /usr/ports/security/pam_pwdfile instead.

So after installing the vsftpd and pam_pwdfile ports, do the following:

(1) in /etc/pam.d, make a file named “vsftpd” and put the following lines in it:

auth required /usr/local/lib/pam_pwdfile.so pwdfile /etc/vsftpd_login.db
account required /usr/lib/pam_permit.so

(2) make a password file with the apache htpasswd utility:

htpasswd -c -b /etc/vsftpd_login.db USERNAME PASSWORD

(3) make a local user with “nologin” as the shell and disable password login. I use “vsftp” for this.

(4) in /usr/local/etc/vsftpd.conf, disable anonymous access and enable local user access, and then add the following:

/usr/chroot_local_user=YES
guest_enable=YES
guest_username=vsftp
listen=YES
background=YES

pam_service_name=vsftpd

user_config_dir=/usr/local/etc/vsftpd
virtual_use_local_privs=YES

Note the value of “guest_usrname” is the local user name you made in step (3)

(5) make a directory /usr/local/etc/vsftpd, and write user specific configurations in a file named after the user’s login name. For example, someone with full write access will have something like this:

anon_mkdir_write_enable=YES
anon_other_write_enable=YES
anon_upload_enable=YES
write_enable=YES

(6) It should be OK now, add vsftpd_enable=”YES” into /etc/rc.conf as usual, and restart vsftpd to see if everything works fine.

Tags: , , , , , , , , ,

Comments 34

  1. jose miguel wrote:

    Hi.
    I’ve tried to implement vsftpd using your recipe but I cannot log in with a valid user. The /var/log/messages file lists:
    vsftpd: in openpam_load_module(): no /usr/local/lib/pam_pwdfile.so found
    The point is that I can list /usr/local/lib/pam_pwdfile.so

    Any idea?

    Thanks

    Posted 10 Dec 2009 at 10:40 pm
  2. Markus wrote:

    @Jose: I’ve got the same error. Seems to be a known issue in FreeBSD 8.0-RELEASE at the moment. This is very annoying concerning the fact that the pam_userdb.so module is not available in FreeBSD, either (which is how I do virtual users in Linux).

    @dryice: Nice tut, anyway. Thx.

    Posted 11 Mar 2010 at 7:58 am
  3. Markus wrote:

    Update: Problem solved!

    1. uninstall broken pam_pwdfile:
    pkg_delete pam_pwdfile-0.99

    2. Install pam_pwdfile from the ports:
    cd /usr/ports/security/pam_pwdfile
    make install clean

    3. Enjoy!

    (4. optionally also install vsftpd from the ports, since it is also a newer release)

    Posted 11 Mar 2010 at 8:30 am
  4. Kamagra Jelly wrote:

    Thanks for the post. I will give a try. Because it is quite hard to find information about it. I have been searching a lot and finally I found you page. I hope that I don’t problem with it.

    Posted 03 Nov 2010 at 11:47 pm
  5. Anna wrote:

    I recommend is to have several good watch …..
    They not only work fine and affordable …..
    Franck Muller Watches
    Hublot

    Posted 03 May 2011 at 2:08 pm
  6. buy lovegra wrote:

    Very nice post… Thanks for sharing this code. I would like to see more unique update from you.

    Posted 10 Jun 2011 at 2:40 pm
  7. generic viagra wrote:

    wow… Very useful information.. Your blog is very helpful for updating my knowledge. I will look forward for your future updates.

    Posted 10 Jun 2011 at 2:42 pm
  8. buy generic viagra wrote:

    This is really interesting information.Topic is is explained very well here.Thanks for your post.

    Posted 10 Jun 2011 at 2:45 pm
  9. Generic Viagra wrote:

    great information thanks for sharing this podt

    Posted 01 Aug 2011 at 3:41 pm
  10. Viagra Generic wrote:

    Thanks for sharing such a wonderful post..Loved reading each and every word!!

    Posted 05 Aug 2011 at 6:01 pm
  11. generic viagra wrote:

    that was nice to read,, thanks for sharing.. love to read that..

    Posted 19 Aug 2011 at 8:21 pm
  12. generic viagra wrote:

    This is very good article. Thanks for explaining about the topic in nice way. You have shared very nice information here.

    Posted 23 Aug 2011 at 11:47 am
  13. buy leather jacket wrote:

    I completely agree over your point and simply loved the topic that you choose. It is very straight and to the point, your thoughts and views are getting conveyed.

    Posted 26 Aug 2011 at 2:35 pm
  14. Buy Generic Viagra wrote:

    Great piece of information shared. Keep Posting..!!!

    Posted 05 Sep 2011 at 3:01 pm
  15. Generic levitra wrote:

    Hey,
    Excellent initiative!I like your blog posting… This is good posting information..

    Posted 20 Sep 2011 at 11:27 pm
  16. Generic Viagra wrote:

    Hi….,
    You did a great work here. Thanks for sharing blog. Keep it up….

    Posted 21 Sep 2011 at 6:05 pm
  17. generic viagra wrote:

    Interesting Post, Vengeful Gladiator’s Leather Gloves equipped can interrupt Shade using their Deadly Throw ability.

    Posted 24 Sep 2011 at 7:37 pm
  18. Buy generic viagra wrote:

    Good post. I study something tougher on totally different blogs everyday. It should at all times be stimulating to learn content material from other writers and follow a bit something from their store

    Posted 26 Sep 2011 at 1:45 am
  19. Buy Dapoxetine 100mg wrote:

    Hey,
    Great post thanks and wonderful informative site.Thanks for sharing this interesting information and thank you very much………

    Posted 28 Sep 2011 at 11:32 pm
  20. Buy sildenafil wrote:

    Thanks for sharing this great article! I feel strongly about it and love learning more on this topic. It is extremely helpful for me. I hope you post again soon

    Posted 29 Sep 2011 at 6:50 pm
  21. Lingerie wrote:

    Good post. I study something tougher on totally different blogs everyday. It should at all times be stimulating to learn content material from other writers and follow a bit something from their store

    Posted 30 Sep 2011 at 2:57 pm
  22. buy generic viagra wrote:

    Excellent stuff written and shred by author..This post is very informative.Thanks!!

    Posted 01 Oct 2011 at 2:15 pm
  23. Generic viagra wrote:

    Thanks. I was needign this from a ong time. Your code had solevd my problem now.

    Posted 04 Oct 2011 at 1:17 am
  24. Generic Viagra wrote:

    Hey,
    These are amazing themes found here… Very interesting. Thanks a lot for the share.and very beautiful….

    Posted 15 Oct 2011 at 11:14 pm
  25. Generic Viagra wrote:

    I wonder how you got so good. This is really a fascinating blog, lots of stuff that I can get into. One thing I just want to say is that your Blog is so perfect!

    Posted 19 Oct 2011 at 2:47 pm
  26. generic viagra wrote:

    Great theme..I visit this blog regularly and every time i found something unique data..Amazing blog provided.Thanks!!

    Posted 25 Oct 2011 at 12:48 pm
  27. cheap generic viagra wrote:

    Wonderful theme..I think you given a most impressive articles..Thanks for sharing such a great blog.

    Posted 13 Jan 2012 at 2:23 pm
  28. Viagra online wrote:

    This is really interesting information.Topic is is explained very well here.Thanks for your post.

    Posted 14 Mar 2012 at 12:39 pm
  29. hosting services wrote:

    This is such a great resource that you are providing and you give it away for free. I love seeing websites that understand the value of providing a quality resource for free.

    Posted 15 Mar 2012 at 8:17 pm
  30. David wrote:

    hi the option :
    user_config_dir
    seems dosen’t work i don’t know why?

    Posted 18 Dec 2013 at 12:22 am
  31. poul wrote:

    Processing is wonderful. The way you tell the thing is awesome. You are a master. Great blog!!! That was amazing your thought
    Generic Viagra

    Posted 09 Apr 2014 at 5:57 pm
  32. Smithb61 wrote:

    You are my inhalation, I have few blogs and sometimes run out from to brand. acdacabekcgfgdee

    Posted 01 May 2014 at 12:24 am
  33. Pharmd440 wrote:

    Very nice site!

    Posted 04 May 2014 at 9:37 am
  34. bimatoprost online wrote:

    Hello, I have browsed most of your recent posts. This post is where I got the most useful information for my research. Thanks for posting, maybe we can see more on this. Are you aware of any other websites on this subject.

    Posted 11 Aug 2014 at 8:53 pm

Post a Comment

You could use <code type="name"> to get your code colorized

Your email is never published nor shared. Required fields are marked *

Close
E-mail It