## :school: **Installation & test FTP Server using vsftpd**
:book: Learn about VM, add ssh in mobaxterm, and installation FTP Server
<div style="background-color: #d4edda; padding: 20px;">
List the essential information of this chapter.
1.Connect VM to SSH Linux in Mobaxterm
2.Installation & test FTP Server
</div>
# 1. Connect VM to SSH Linux in Mobaxterm
but before that, in this tutorial using Ubuntu OS for the entire VM process
in VirtualBox, open > settings > network then select **Bridged Adapter**
### 1.1 Command Connect VM using SSH
<div style="background-color: #f2f2f2; border: 5px solid #003366; padding: 30px;">
<p>1. sudo apt-get install openssh-server</p>
<p>2. sudo systemctl enable ssh</p>
<p>3. sudo systemctl start ssh</p>
<p>4. systemctl status sshd</p>
</div>

this is result after successfully enabling ssh
after that, look for the VM's inet as ssh connection address in mobaxterm. Using **ifconfig**

so we have an internet ip 182.168.11.105
### 1.2 Connect SSH to Mobaxterm
ssh server@inet

after it works, try to ping

# 2. Installation & test FTP Server
### 2.1 Installation FTP Server (vsftpd)
<div style="background-color: #f2f2f2; border: 5px solid #003366; padding: 30px;">
<p>1. sudo apt-get update</p>
<p>2. sudo apt-get install vsftpd</p>
</div>
### 2.2 Configuration FTP Server
* Edit configuration vsftpd
<div style="background-color: #f2f2f2; border: 5px solid #003366; padding: 30px;">
<p>sudo nano /etc/vsftpd.conf</p>
</div>
* Make sure you enable or add the following settings
<div style="background-color: #f2f2f2; border: 5px solid #003366; padding: 30px;">
<p>anonymous_enable=NO</p>
<p>local_enable=YES</p>
<p>write_enable=YES</p>
<p>chroot_local_user=YES</p>
<p>allow_writeable_chroot=YES</p>
</div>
* Add the following settings if not already present
<div style="background-color: #f2f2f2; border: 5px solid #003366; padding: 30px;">
<p>user_sub_token=$USER</p>
<p>local_root=/home/$USER/ftp</p>
<p>pasv_min_port=10000</p>
<p>pasv_max_port=10100</p>
</div>
### 2.3 Create Directory FTP
<div style="background-color: #f2f2f2; border: 1px solid #000000; padding: 10px;">
mkdir -p /home/username/ftp
</div>

<div style="background-color: #f2f2f2; border: 1px solid #000000; padding: 10px;">
chown nobody:nogroup /home/username/ftp
</div>

<div style="background-color: #f2f2f2; border: 1px solid #000000; padding: 10px;">
chmod a-w /home/username/ftp
</div>

<div style="background-color: #f2f2f2; border: 1px solid #000000; padding: 10px;">
mkdir -p /home/username/ftp/files
</div>

<div style="background-color: #f2f2f2; border: 1px solid #000000; padding: 10px;">
chown username:username /home/username/ftp/files
</div>

* After that, restart vsftpd to apply changes and make sure FTP server can run
<div style="background-color: #f2f2f2; border: 5px solid #003366; padding: 30px;">
<p>sudo systemctl restart vsftpd</p>
<p>sudo systemctl status vsftpd </p>
</div>

### 2.4 Test with Command Line
<div style="background-color: #f2f2f2; border: 1px solid #000000; padding: 10px;">
ftp your_server_ip
</div>
Enter username and password

Input local file (.txt and other)

* See list file
**ls**
* Upload file
**put local_file**
* Download file
**get remote_file**

