---
# System prepended metadata

title: Installation & test FTP Server using vsftpd

---

## :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>


![Screenshot 2024-07-29 113721](https://hackmd.io/_uploads/rJ7hn5VK0.png)
this is result after successfully enabling ssh

after that, look for the VM's inet as ssh connection address in mobaxterm. Using **ifconfig**
![Screenshot 2024-07-29 114734](https://hackmd.io/_uploads/BJJ-1iEtR.png)
so we have an internet ip 182.168.11.105

### 1.2 Connect SSH to Mobaxterm
ssh server@inet
![2](https://hackmd.io/_uploads/r1lxgo4tR.png)

after it works, try to ping 
![3](https://hackmd.io/_uploads/BkdmxiEK0.png)

# 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>

![8](https://hackmd.io/_uploads/B1RlpzBYC.png)

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

![9](https://hackmd.io/_uploads/H1_z6fHt0.png)

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

![10](https://hackmd.io/_uploads/HJwBpGSY0.png)

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

![11](https://hackmd.io/_uploads/BkAP6fSYA.png)

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

![12](https://hackmd.io/_uploads/SkyiTMBK0.png)

* 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>

![13](https://hackmd.io/_uploads/H1RoAMrKC.png)

### 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
![14](https://hackmd.io/_uploads/S1l_JXSF0.png)

Input local file (.txt and other)
![15](https://hackmd.io/_uploads/rJnTkXSFA.png)

* See list file
**ls**
* Upload file
**put local_file**
* Download file
**get remote_file**
![16](https://hackmd.io/_uploads/HyRLg7SY0.png)
![17](https://hackmd.io/_uploads/H16LgmHt0.png)



















