View Single Post
  #6   (View Single Post)  
Old 24th October 2008
DNAeon DNAeon is offline
Shell Scout
 
Join Date: Sep 2008
Location: Bulgaria
Posts: 138
Default

Hi!

The right way to fire up your vsftpd server is the following:

1. Create the /etc/pam.d/vsftpd
Code:
auth required /usr/local/lib/pam_pwdfile.so pwdfile /etc/vsftpd_login.db
account required /usr/lib/pam_permit.so
2. Create the user virtual users will be mapped to - virtual for example:
Code:
# adduser -v
Username: virtual
Full name: Virtual FTP user
Uid (Leave empty for default):
Login group [virtual]:
Login group is virtual. Invite virtual into other groups? []:
Login class [default]:
Shell (sh csh tcsh bash rbash nologin) [sh]: nologin
Home directory [/home/virtual]:
Use password-based authentication? [yes]:
Use an empty password? (yes/no) [no]:
Use a random password? (yes/no) [no]:
Enter password:
Enter password again:
Lock out the account after creation? [no]:
Username   : virtual
Password   : *****
Full Name  : Virtual FTP user
Uid        : 1007
Class      :
Groups     : virtual
Home       : /home/virtual
Shell      : /usr/sbin/nologin
Locked     : no
OK? (yes/no): yes
adduser: INFO: Successfully added (virtual) to the user database.
Add another user? (yes/no): no
Goodbye!
3. Create the password database for vsftpd with the htpasswd tool - /etc/vsftpd_login.db
Code:
htpasswd -c -b /etc/vsftpd_login.db USERNAME PASSWORD
4. Create the vsftpd.conf file - this is mine
Code:
anonymous_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
anon_world_readable_only=NO

listen=YES
listen_address=x.x.x.x
listen_port=21

max_clients=200 # change these to whatever you want
max_per_ip=5

write_enable=NO
local_enable=YES
pam_service_name=vsftpd

pasv_min_port=50000 # change these too if you have a firewall running
pasv_max_port=50999 

xferlog_enable=YES

chroot_local_user=YES
secure_chroot_dir=/usr/local/share/vsftpd/empty/

guest_enable=YES
guest_username=virtual

ls_recurse_enable=NO
ascii_download_enable=NO
ascii_upload_enable=NO
5. Fire up your vsftpd server
Code:
# /usr/local/libexec/vsftpd &
6. Start using vsftpd

That's it - I needed an ftp server and today I decided to install vsftpd. This is how I did it and it works like a charm

Cheers,
DNAeon
__________________
"I never think of the future. It comes soon enough." - A.E

Useful links: FreeBSD Handbook | FreeBSD Developer's Handbook | The Porter's Handbook | PF User's Guide | unix-heaven.org
Reply With Quote