-
-
Save NickLaMuro/c883a997c7ae943dd684bccd469cea43 to your computer and use it in GitHub Desktop.
Simple FTP server Vagrant VM
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
# Simple Centos based FTP server with both vagrant user and anonymous access provided | |
# | |
# vagrant user credentials are just `vagrant:vagrant` | |
Vagrant.configure("2") do |config| | |
config.vm.box = "centos/7" | |
config.vm.define :ftp do |ftp| | |
ftp.vm.network :private_network, :ip => '192.168.50.3' | |
ftp.vm.provision :shell, :inline => <<-SHELL.gsub(/ {6}/, '') | |
yum install -y vsftpd ftp | |
cat << EOF > /etc/vsftpd/vsftpd.conf | |
listen=NO | |
listen_ipv6=YES | |
local_enable=YES | |
local_umask=022 | |
write_enable=YES | |
connect_from_port_20=YES | |
anonymous_enable=YES | |
anon_root=/var/ftp/pub | |
anon_umask=022 | |
anon_upload_enable=YES | |
anon_mkdir_write_enable=YES | |
anon_other_write_enable=YES | |
pam_service_name=vsftpd | |
userlist_enable=YES | |
userlist_deny=NO | |
tcp_wrappers=YES | |
EOF | |
cat << EOF > /etc/vsftpd/user_list | |
vagrant | |
anonymous | |
EOF | |
mkdir -p /var/ftp/pub/uploads | |
chown -R ftp:ftp /var/ftp | |
chmod -R 555 /var/ftp/pub | |
chmod 777 /var/ftp/pub/uploads | |
setsebool -P allow_ftpd_anon_write=1 | |
chcon -R -t public_content_t /var/ftp/pub | |
chcon -t public_content_rw_t /var/ftp/pub/uploads | |
systemctl restart vsftpd || systemctl start vsftpd | |
SHELL | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment