MENU
FTP
If you were to use a cloud computing service such as Google Compute Engine of the Google Cloud Platform, you will be constantly transferring files between your local computer and the remote server. An FTP (File Transfer Protocol) client such as FileZilla proves handy here. It can be downloaded to the local computer for free.
To enable FTP on a remote Windows server, install FileZilla Server.
To enable FTP on a remote Linux server:
sudo apt update && sudo apt install vsftpd
sudo service vsftpd status
sudo ufw allow OpenSSH
sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw enable
sudo ufw status
where the last few lines configure the firewall. Then edit the configuration file:
sudo nano /etc/vsftpd.conf
and uncomment the following lines by removing the # sign in front:
write_enable=YES
chroot_local_user=YES
local_umask=022
To securely transfer files over SFTP (Secure File Transfer Protocol), change to YES the following option:
ssl_enable=YES
and add:
rsa_cert_file=/etc/ssl/private/vsftpd.pem
rsa_private_key_file=/etc/ssl/private/vsftpd.pem
allow_anon_ssl=NO
force_local_data_ssl=YES
force_local_logins_ssl=YES
ssl_tlsv1=YESssl_sslv2=NO
ssl_sslv3=NO
require_ssl_reuse=NO
ssl_ciphers=HIGH
To generate the private key (.../vsftpd.pem), enter the command:
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048
-keyout /etc/ssl/private/vsftpd.pem
-out /etc/ssl/private/vsftpd.pem<
Finally, restart vsftpd:
sudo systemctl restart vsftpd
Some cloud service providers such as Google Compute Engine require you to setup the external IP and firewall rules on their interface too.
It is also possible to automate the transfer of files with scripts.
For instance, to upload files from Windows, locally create a batch file ftp_mysite.bat:
echo open 175.141.54.183 > temp.txt
echo username>> temp.txt
echo password>> temp.txt
echo prompt >> temp.txt
echo mput * >> temp.txt
echo quit>> temp.txt
ftp -s:temp.txt
del temp.txt
For details on how to use the FTP command, enter 'ftp' then enter 'help' on the FTP prompt to list all the possible FTP commands. To get an explanation on a particular FTP command such as 'get', enter 'help get'.To upload from Linux:
# ./transfer_my_site
HOST=ftp.example.com
USER=ftpuser
PASSWORD=P@ssw0rd
ftp -inv $HOST <<EOFuser $USER $PASSWORD
cd /path/to/file
mput *.html
bye
EOF
Then make the script executable and test it:
chmod 700 transfer_my_site
./transfer_my_site