Login | Register
ID #1002

Various VSFTPD Fixes By Ubuntu Version

Note to EHCP Users:

If you are using a working installation of EHCP Force Edition or the normal EHCP that works without issues, be cautious when upgrading to a later version of Ubuntu.  If you upgrade to a later Ubuntu version, you may run into some problems after updating.  In particular, FTP (powered by VSFTPD) may not work. The reason is that the Ubuntu VSFTPD package is broken in versions 12.04 - 14.10.  As new versions of Ubuntu are released, we will of course work on a fix for FTP functionality assuming the package is still broken.

The EHCP Force installer corrects all of these issues automatically during install, and so do our update & upgrade scripts.

Fix VSFTPD Problems by Ubuntu Version (To Support Virtual Users):

Whether or not you run EHCP, here are the commands you'll need to run to fix broken VSFTPD virtual user functionality depending on your Ubuntu version.

Ubuntu 12.04 (32-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
sudo add-apt-repository -y ppa:thefrontiergroup/vsftpd
sudo apt-get update
sudo apt-get install vsftpd
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 12.04 (64-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
sudo add-apt-repository -y ppa:thefrontiergroup/vsftpd
sudo apt-get update
sudo apt-get install vsftpd
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 12.10 (32-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
wget -O "vsftpd_2.3.5-3ubuntu1.deb" http://dinofly.com/files/linux/vsftpd_2.3.5-3ubuntu1_i386.deb
sudo dpkg -i vsftpd_2.3.5-3ubuntu1.deb
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 12.10 (64-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
wget -O "vsftpd_2.3.5-3ubuntu1.deb" http://dinofly.com/files/linux/vsftpd_2.3.5-3.jme_amd64.deb
sudo dpkg -i vsftpd_2.3.5-3ubuntu1.deb
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 13.04 (32-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
wget -O "vsftpd_3.0.2-patched_ubuntu.deb" http://dinofly.com/files/linux/vsftpd_3.0.2-patched_ubuntu_13.04_x86.deb
sudo dpkg -i vsftpd_3.0.2-patched_ubuntu.deb
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 13.04 (64-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
wget -O "vsftpd_3.0.2-patched_ubuntu.deb" http://dinofly.com/files/linux/vsftpd_3.0.2-1ubuntu1_amd64_patched.deb
sudo dpkg -i vsftpd_3.0.2-patched_ubuntu.deb
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 13.10 (32-Bit):

wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 13.10 (64-Bit):

wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 14.04 (32-Bit):

wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 14.04 (64-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
wget -N -O "vsftpd_3.0.2-1ubuntu2.deb" http://dinofly.com/files/linux/vsftpd_3.0.2-1ubuntu2_amd64.deb
sudo dpkg -i vsftpd_3.0.2-1ubuntu2.deb
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 14.10 (32-Bit):

wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 

Ubuntu 14.10 (64-Bit):

sudo apt-get remove vsftpd
sudo dpkg --remove vsftpd
wget -N -O "vsftpd_3.0.2-14ubuntu1.deb" http://www.dinofly.com/files/linux/vsftpd_3.0.2-14ubuntu1_amd64.deb
sudo dpkg -i vsftpd_3.0.2-14ubuntu1.deb
wget -N -O "fix_vsftpd_conf.tar.gz" http://dinofly.com/files/linux/fix_vsftpd_conf.tar.gz
tar -zxvf fix_vsftpd_conf.tar.gz
sudo bash fix_vsftpd_conf.sh

 


 

fix_vsftpd_conf.sh contents:

For those interested, the contents of the bash script fix_vsftpd_conf.sh are:

#!/bin/bash
#Author: Eric Arnol-Martin
#Updates VSFTPD configuration to allow virtual users on Ubuntu 10.04 - Ubuntu 14.10

###############
# FUNCTIONS   #
###############

function aptgetInstall(){

	if [ -n "$noapt" ] ; then  # skip install
		echo "skipping apt-get install for:$1"
		return
	fi

	# first, try to install without any prompt, then if anything goes wrong, normal install..
	cmd="apt-get -y --no-remove --allow-unauthenticated install $1"
	$cmd
	
	if [ $? -ne 0 ]; then
		cmd="apt-get --allow-unauthenticated install $1"
		$cmd	
	fi
	
	PackageFailed="$?"

}

function getDistroInfo() {	
		# Get distro properly
		if [ -e /etc/issue ]; then
			distro=$( cat /etc/issue | awk '{ print $1 }' )
		fi
		
		if [ -z "$distro" ]; then
			if [ -e /etc/os-release ]; then
				distro=$( cat os-release | grep -o "^NAME=.*" | grep -o "[^NAME=\"].*[^\"]" )
			fi
		fi
		
		# Assume Ubuntu
		if [ -z "$distro" ]; then
			distro="ubuntu"
		else
			# Convert it to lowercase
			distro=$( echo $distro | awk '{print tolower($0)}' )
		fi
		 
		# Get actual release version information
		version=$( cat /etc/issue | awk '{ print $2 }' )
		if [ -z "$version" ]; then
			version=$( lsb_release -r | awk '{ print $2 }' )
		fi
		
		# Separate year and version
		if [[ "$version" == *.* ]]; then
			yrelease=$( echo "$version" | cut -d. -f1 )
			mrelease=$( echo "$version" | cut -d. -f2 )
		fi
		
		# Get 64-bit OS or 32-bit OS [used in vsftpd fix]
		if [ $( uname -m ) == 'x86_64' ]; then
			OSBits=64
		else
			OSBits=32
		fi 
		
		echo "Your distro is $distro runnning version $version"
}

function fixVSFTPConfig(){ # by earnolmartin@gmail.com
	# VSFTPD config file
	VSFTPDCONF="/etc/vsftpd.conf"	
	
	# Check to see if the chroot_local_user setting is present
	chrootLocalCheck=$(cat "$VSFTPDCONF" | grep "chroot_local_user")
	if [ -z "$chrootLocalCheck" ]; then
		sh -c "echo 'chroot_local_user=YES' >> $VSFTPDCONF"
	else
		sed -i 's/chroot_local_user=.*/chroot_local_user=YES/g' "$VSFTPDCONF"
	fi
		
	# Check to see if allow writeable chroot is present
	allowWriteValue=$(cat "$VSFTPDCONF" | grep "allow_writeable_chroot")
	if [ -z "$allowWriteValue" ]; then
		sh -c "echo 'allow_writeable_chroot=YES' >> $VSFTPDCONF"
	else
		sed -i 's/allow_writeable_chroot=.*/allow_writeable_chroot=YES/g' "$VSFTPDCONF"
	fi

	if [ $OSBits -eq "64" ]; then 
		libldapFix
		aptgetInstall libgcc1
		
		# 64-bit 500 OOPS: priv_sock_get_cmd Fix
		# seccomp_sandbox=NO
		allowSandBox=$(cat "$VSFTPDCONF" | grep "seccomp_sandbox")
		if [ -z "$allowSandBox" ]; then
			if [ "$yrelease" -ge "13" ] ; then
				sh -c "echo 'seccomp_sandbox=NO' >> $VSFTPDCONF"
			fi
		else
			sed -i 's/seccomp_sandbox=.*/seccomp_sandbox=NO/g' "$VSFTPDCONF"
		fi		
	fi
	
	# Restart the VSFTPD service
	service vsftpd restart
}

function libldapFix(){ # by earnolmartin@gmail.com
	# install libldap, for vsftpd fix, without prompts
	DEBIAN_FRONTEND=noninteractive apt-get -y install libpam-ldap
	wget -N -O "ldap_conf.tar.gz" http://dinofly.com/files/linux/ldap_conf_64bit_vsftpd.tar.gz
	tar -zxvf ldap_conf.tar.gz
	cp ldap.conf /etc/
}  

###############
# Main App    #
###############
getDistroInfo
fixVSFTPConfig

Tags: 12.04, 12.10, 13.04, 13.10, 14.04, 14.10, 64-bit, 64bit, broken, fix, fixes, ftp, not, ubuntu, vsftpd, work, working, works, x64

Related entries:

You can comment this FAQ