2013-05-03

Install and setup vsFTP on Ubuntu


1. Install packages
apt-get install vsftpd libpam-pwdfile

If you’re using Ubuntu 12.04, please check Issue 2 below.



2. Edit vsFTP permission config file

Edit /etc/pam.d/vsftpd, content is:
@include common-session
auth required pam_pwdfile.so pwdfile /etc/ftpd.passwd
account required pam_permit.so


3. Create FTP users

Create password file for new user
touch /etc/ftpd.passwd
htpasswd -bd /etc/ftpd.passwd hydra hydra123!
You can add more users by using...
htpasswd /etc/ftpd.passwd admin 1234
Create home folder for FTP users
mkdir /var/ftp/hydra
chown vsftpuser:nogroup /var/ftp/hydra
chmod -w /var/ftp/hydra


4. Create vsFTP user

Create system user for vsFTP service
useradd --home /home/vsftpuser --gid nogroup -m --shell /bin/false vsftpuser


5. Edit config file

Edit /etc/vsftpd.conf
anonymous_enable=NOlocal_enable=YESwrite_enable=YESlocal_umask=022nopriv_user=vsftpdvirtual_use_local_privs=YESguest_enable=YESuser_sub_token=$USERlocal_root=/var/ftp/$USERchroot_local_user=YEShide_ids=YESguest_username=vsftpuserallow_writeable_chroot=YES
Restart service
/etc/init.d/vsftpd restart

Issues


Issue 1. 421 OOPS

Root cause:
Passwd file cannot be recognized by pam_pwdfile.so

Solution:
Use htpasswd -bd instead of htpasswd -c


Issue 2. 500 OOPS: vsftpd: refusing to run with writable root inside chroot()

You need to add this line into /etc/vsftpd.conf

allow_writeable_chroot=YES

But unfortunately, vsftpd 2.3.5 on Ubuntu 12.04 doesn’t support this feature. Server will be no response if you add writable chroot. There is a temp solution, to backport it from vsftp 3 into 2.3.5 by using these commands:
sudo add-apt-repository ppa:thefrontiergroup/vsftpd
sudo apt-get update
sudo apt-get install vsftpd
For example:
wget https://launchpad.net/~thefrontiergroup/+archive/vsftpd/+files/vsftpd_2.3.5-1ubuntu2ppa1_amd64.debsudo dpkg -i vsftpd_2.3.5-1ubuntu2ppa1_amd64.deb

1 comment:

Anonymous said...

sands casino online
Welcome to Sands Casino online! Play the most exciting 샌즈카지노 online casino slots games 1xbet and 메리트 카지노 쿠폰 enjoy the best of Free Spins! Play for real prizes. Enjoy our 100% welcome