Pages

Friday, 6 July 2012

VSFTPD – Creating Virtual Users on Linux

VSFTPD – Creating Virtual Users on Linux 

Virtual Users means, there is no need to create system users or physical user accounts, users can be maintained using htpasswd. Using virtual users, they can get access to same ftp files via Apache.

Download and Install pam-pam_pwdfile from here.

# wget ftp://ftp.pbone.net/mirror/ftp.pld-linux.org/dists/2.0/PLD/i386/PLD/RPMS/pam-pam_pwdfile-0.99-2.i386.rpm

# rpm -ivh pam-pam_pwdfile-0.99-2.i386.rpm

Now, append following lines to /etc/pam.d/vsftpd.pwd.

# vim /etc/pam.d/vsftpd.pwd

auth required pam_listfile.so item = user sense = deny file = /etc/vsftpd/ftpusers onerr = succeed

auth required pam_pwdfile.so pwdfile /etc/vsftpd/vsftpd_pwdfile

# pam_pwdfile doesn’t come with account, so we just permit, on success:

account required pam_permit.so

Save and exit the file.

Now configure FTP configuration file,

# vim /etc/vsftpd/vsftpd.conf

# we’re running standalone

listen = YES

# enable virtual users:

anonymous_enable = NO

local_enable = YES

guest_enable = YES

# Where the accounts are located..

guest_username = ftp

user_sub_token = $USER

local_root = /home/LinuxFTP/store/$USER

chroot_local_user = YES

# allow writing

write_enable = YES

local_umask = 022

virtual_use_local_privs = YES

# some general options

dirmessage_enable = YES

hide_ids = YES

connect_from_port_20 = YES

# here we define OUR pam config [see above]

pam_service_name = vsftpd.pwd

# more verbose logging

xferlog_enable = YES

log_ftp_protocol = YES

setproctitle_enable = YES

#banner

ftpd_banner = “Welcome to LinuxArticles.org.”

Save and exit the file.

Restart FTP service and make it available across reboot.

# service vsftpd restart ; chkconfig vsftpd on

Finally, create new password file & user.

# htpasswd -c -b /etc/vsftpd/vsftpd_pwdfile username password

1 comment:

Twitter Bird Gadget