Skip to content

Instantly share code, notes, and snippets.

@yourdesigncoza
Created April 25, 2013 15:27
Show Gist options
  • Save yourdesigncoza/5460615 to your computer and use it in GitHub Desktop.
Save yourdesigncoza/5460615 to your computer and use it in GitHub Desktop.
vsftpd stand for "very secure" and the program was built to have strongest protection against possible FTP vulnerabilities.
# vsftpd - Very Secure Deamon
# IMPORTANT : add your own data or parameters, I make use of double segments [[ your variable ]]. eg. ssh root@[[ 96.172.44.11 ]] should be replaced with ssh root@888.88.88.88 where "888.88.88.88" is your value, variable etc. I have a habit of using ":::" to indicate line ending and end of paragraph, crazy I know but be warned its just how I write ::: All notes are for my own use & should you use any it's at your own risk, it's NOT a Tutorial :::
# Resource
# https://help.ubuntu.com/12.04/serverguide/ftp-server.html
# https://help.ubuntu.com/community/vsftpd
# http://www.noob2geek.com/linux/setup-vsftpd-debian-ubuntu/
# Install vsftpd
sudo apt-get install vsftpd
# By Default vftpd is installed in the root ( eg./home/ftp )
# for scurity make own directory ( eg. srv )
sudo mkdir -p /srv/ftp
sudo usermod -d /srv/ftp ftp
# Disallow anonymous download /etc/vsftpd.conf by changing
# anonymous_enable=Yes
anonymous_enable=No
# allow the user to write to the directory.
local_enable=YES
# Write permissions
write_enable=YES
# OPTIONAL :
# When this line is set to Yes, all the local users will be jailed within their chroot and will be denied access to any other part of the server.
chroot_local_user=YES
# You can also limit a specific list of users to just their home directories:
chroot_list_enable=NO ( need access to /var/www )
# END OPTIONAL
# set umask to 022 to make sure that all the files (644) and folders (755) you upload get the proper permissions.
local_umask=022
# Save
# Because of a recent vsftpd upgrade, vsftpd is "refusing to run with writable root inside chroot". A handy way to address this issue to is to take the following steps:
# sudo mkdir /home/[[ username ]]/files
# Change the ownership of that file to root
# sudo chown root:root /home/[[ username ]]
# After making the change restart vsftpd:
sudo restart vsftpd
##############################
# IMPORTANT
##############################
# WWW dir in eg. Filezilla
/var/www
# Ensure www permissions are set right
sudo chown -R [[ user ]] /var/www/
sudo chown -R [[ user ]]:www-data /var/www
# File & Dir permissions
sudo find /var/www -type f -exec chmod 664 {} \; # files
sudo find /var/www -type d -exec chmod 755 {} \; # directories
# See if your username is part of groups
groups
# Add a user to goups
sudo usermod -a -G group [[ username ]]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment