Linux File Transferring

LinuxLinuxBeginner
Practice Now

Introduction

In ancient Egypt, the Pharaoh's palace was a hub of both ceremonial grandeur and bustling daily activity. Imagine being the newly appointed Treasurer under Pharaoh's rule, a role of immense importance and complexity. Your primary function is to manage the wealth flowing into the coffers, ensuring accurate records and the safe transfer of commodities throughout the kingdom. With caravans bringing goods from distant lands and scrolls detailing transactions needing constant exchange, your responsibility extends to the secure and efficient handling of vital information.

In an era of hieroglyphs and papyrus, we challenge you to think like the ancients but with a twist of modern ingenuity. Imagine you've just discovered a way to use the mystical powers of 'Ftpet' (FTP - File Transfer Protocol) to exchange scrolls between various departments within the palace, a technology far ahead of its time.

The goal of this Lab is to harness the power of Ftpet and transfer crucial scrolls securely and efficiently, ensuring the prosperity of the kingdom remains uninterrupted.


Skills Graph

%%%%{init: {'theme':'neutral'}}%%%% flowchart RL linux(("`Linux`")) -.-> linux/RemoteAccessandNetworkingGroup(["`Remote Access and Networking`"]) linux/RemoteAccessandNetworkingGroup -.-> linux/ftp("`File Transferring`") subgraph Lab Skills linux/ftp -.-> lab-271287{{"`Linux File Transferring`"}} end

Establishing the Ftpet Connection

In this step, you will venture into the sacred catacombs of the palace to set up the Ftpet server, ensuring that all departments can access the scrolls they need. Prior to using Ftpet, you must conjure an area to store the scrolls.

First, create a directory named 'Scrolls' under ~/project where we will keep the scrolls:

mkdir ~/project/Scrolls

Next, let's install the vsftpd server which will wield the Ftpet's power. Enter the following incantation in the terminal:

sudo apt update
sudo apt install vsftpd -y

Once installed, create a magical configuration file named vsftpd.conf to control the Ftpet daemon:

sudo vim /etc/vsftpd.conf

Add the following ancient spells (configurations) to the vsftpd.conf:

listen=NO
listen_ipv6=YES
anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=022
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
pasv_enable=Yes
pasv_min_port=10000
pasv_max_port=10100

Conclude by summoning the Ftpet daemon:

sudo systemctl restart vsftpd

if it occurs the following error:

System has not been booted with systemd as init system (PID 1). Can't operate.
Failed to connect to bus: Host is down

you can try the following command:

sudo /etc/init.d/vsftpd start

Transferring the Sacred Scrolls

In this step, you'll experience the true power of Ftpet as you transfer the first scroll, "The Inventory of Ra," to the server. First, create the sacred scroll:

echo "Inventory of Ra:\nGold: 100kg\nSilver: 300kg\nGemstones: 500pcs" > ~/project/Scrolls/inventory_of_ra.txt

To connect to the Ftpet server, use the ftp command, replacing treasurer with your actual username and palace-gates with the server address:

ftp treasurer@palace-gates

Once connected, you can transfer the scroll using the Ftpet incantation put:

put inventory_of_ra.txt

After completing the transfer, exit the Ftpet server with this enchanted phrase:

bye

Summary

In this lab, the mystique of ancient Egypt was cleverly intertwined with the practical knowledge of FTP in Linux, creating a unique and engaging way to tackle file transferring in a Linux environment. By imagining the process as ancient scroll handling, the concept of FTP became more approachable and interesting. The lab took learners from setting up an FTP server to transferring files, ensuring a hands-on experience with real-world application. My takeaway is that making learning fun and relevant, even by blending it with historical storytelling, provides an enriching experience that can help to reinforce technical skills.

Other Linux Tutorials you may like