Vsftp with virtual users

Menù di navigazione
  • Home
  • Contacts
HOME | Index |

Vsftp with virtual users

VSFTP with virtual users

In this tutorial we will learn how to install vsftp with virtual user support. We will assume that you HAVE already installed the vsftp application. As we do want a separate ftp server, our configuration is parallel to the standard vsftp config.

First go to

cd /etc/vsftpd

The enter the following lines in the file myserver.conf

vi myserver.conf
pam_service_name=myserver
anonymous_enable=NO
local_enable=YES
write_enable=YES
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=apache
listen=YES
listen_port=5909
pasv_min_port=30000
pasv_max_port=30999
xferlog_file=/var/log/myserver.log
xferlog_std_format=YES

In this case all the files uploaded by our virtual users will be set to apache. The server is running on port 5909 and everything will be logged on var/log/myserver.log . You will have to pay attention to the home directory of the user specified in guest_username setting it to a proper directory where the user will operate.

Then we do

vi /etc/pam.d/myserver

and we enter the following lines

#%PAM-1.0
auth required /lib64/security/pam_userdb.so db=/etc/vsftpd/myserveruser
account required /lib64/security/pam_userdb.so db=/etc/vsftpd/myserveruser

Also in this case you have to pay attention to the pam_userdb location... Our is under lib64!

Then we create a user file map under /etc/vsftpd/

vi myserveruser_map.txt

In this file we enter each virtual user we want. The syntax is quite simple as the username and the password  are put in different lines. The following will define a foo user with a bar password

foo
bar

To compile the file you must type

db41_load -T -t hash -f myserveruser_map.txt /etc/vsftpd/myserveruser.db

Then we will restart the vsftpd service:/etc/init.d/vsftpd restart

/etc/init.d/vsftpd restart

Now you can try the installation by typing

ftp localhost 5909

and login with the user foo and password bar. If everything is ok... you will see the "login successfull" message.

If something goes wrong:

touch /etc/pam_debug
vi /etc/syslog.conf

At the bottom of the file enter:

*.debug***TAB***/tmp/debugpam.log

Then restart syslog

/etc/init.d/syslog restart

Then you can watch into the file /tmp/debugpam.log to look for error messages (yes... you have to try the ftp server!)

Once everything is ok just remove /etc/pam_debug and the inserted line in /etc/syslog.conf and restart syslog.

Labs
  • CentOS + BlueQuartz
  • Installing Spamassassin ClamAv and Mailscanner on Bluequartz
  • SARE Rules & RulesDuJour
  • Installing MRTG
  • Mass Change IP
  • CCED problems
  • Deleting old logfiles
  • POP3 problems
  • Recalculate Quotas
  • How to block an IP address
  • NAMED and DNS
  • PHP
  • Enabling safe mode per-directory
  • Howto install php4 & php5 on Apache2
  • Linux
  • Automating Mysql backups
  • Restoring MySQL dumps
  • Replacing Text In Files
  • Firefox and flash on x86_64
  • Find user's files
  • Lines of code
  • Vsftp with virtual users
  • MSN
  • RandomCase

Home | Contacts | E.R.WEB Official Site