Videos of some previous presentations done at Chicago GLUG meetings have been posted here on our website. The current videos are for the following presentations: Dirvish by John Quigley, VSFTPD Virtual Users by myself and Objective-C by Yacin Nadji. Look for more videos of our presentations and events in the future.
[UPDATE]
The videos are licensed under the GFDL, so the videos are free to distribute in accordance with that license.
Showing posts with label vsftpd. Show all posts
Showing posts with label vsftpd. Show all posts
Monday, April 16, 2007
Tuesday, November 14, 2006
FTP User Individuality
Ok, so I fixed the next issue with my ftp, which is upload access. This is an easy issue if you just want to give everybody and their mother upload access. However, I don't want to do this so I had to setup per-user configuration in vsftpd. Since this is built-in it is a lot easier than it sounds.
I created a couple simple bash scripts that can be used add users and add upload access to users. Both scripts must be ran as root.
Script to add users to your ftp.
Here is the bash script to add upload access to a user.
- Add the following line to /etc/vsftpd/vsftpd.conf:
user_config_dir=/etc/vsftpd/vsftpd_user_conf
anon_world_readable_only=NO - Create that directory:
mkdir /etc/vsftpd/vsftpd_user_conf - Next create the users configuration:
echo "write_enable=YES" >> /etc/vsftpd/vsftpd_user_conf/fred
echo "anon_upload_enable=YES" >> /etc/vsftpd/vsftpd_user_conf/fred
echo "anon_mkdir_write_enable=YES" >> /etc/vsftpd/vsftpd_user_conf/fred
I created a couple simple bash scripts that can be used add users and add upload access to users. Both scripts must be ran as root.
Script to add users to your ftp.
#!/bin/bash
# Name: addFtpUser.sh
# Description: Adds users to /etc/vsftpd/logins.txt and resets the database
# MUST BE RAN AS ROOT
# Arguments: $1=Username $2=Password
# Author: Kevin Harriss
# special.kevin@gmail.com
# Version: 0.01
if [ $# -ne 2 ]
then
echo "Username and Password needed!!!"
else
echo $1 >> /etc/vsftpd/logins.txt
echo $2 >> /etc/vsftpd/logins.txt
db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftpd/vsftpd_login.db
fi
Here is the bash script to add upload access to a user.
#!/bin/bash
# Name: grantFtpUpload.sh
# Description: Gives user upload access to ftp.
# MUST BE RAN AS ROOT
# Arguments: $1=Username
# Author: Kevin Harriss
# special.kevin@gmail.com
# Version: 0.01
if [ $# -ne 1 ]
then
echo "Username needed!!!"
exit
else
echo "write_enable=YES" >> /etc/vsftpd/vsftpd_user_conf/$1
echo "anon_upload_enable=YES" >> /etc/vsftpd/vsftpd_user_conf/$1
echo "anon_mkdir_write_enable=YES" >> /etc/vsftpd/vsftpd_user_conf/$1
fi
Sharing is Caring
I am so excited right now, I finally got my ftp back up and running. I run vsftpd with virtual users and this will be a guide to setting it up.
Anytime you add a user to /etc/vsftpd/logins.txt you have to add the database again by running:
If you would like an account just let me know.
- Install vsftpd. On foresight just run:
sudo conary update vsftpd - Create the file with username and password (/etc/vsftpd/logins.txt). The file is an alternating list of username and passwords:
tom
foo - Add the database file (This requires Berkeley DB program installed):
db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftpd/vsftpd_login.db - Fix database permissions:
chmod 600 /etc/vsftpd/vsftpd_login.db - Setup pam, Change /etc/pam.d/ftp to only contain the following lines:
auth required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login crypt=hash
account required /lib/security/pam_userdb.so db=/etc/vsftpd/vsftpd_login crypt=hash - Create virtual user:
useradd -d /home/ftp virtual - Create /etc/vsftpd/vsftpd.conf containing the following lines:
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=21 - Restart vsftpd:
sudo /etc/init.d/vsftpd restart
Anytime you add a user to /etc/vsftpd/logins.txt you have to add the database again by running:
db_load -T -t hash -f /etc/vsftpd/logins.txt /etc/vsftpd/vsftpd_login.dbIf you would like an account just let me know.
Subscribe to:
Posts (Atom)

