The File Transfer Protocol (FTP) is a universally accepted network protocol utilized for the transfer of files from one machine to another, or to a server. If you’re managing your own Virtual Private Server (VPS) or dedicated server to host your blog or website, it’s advisable to install an FTP service. This will simplify the process of uploading and retrieving any files to the VPS server.
This guide will walk you through the steps to install and configure the vsftpd FTP Server on Ubuntu 14.04.
Step 1: Installing vsftpd FTP Service
To begin, you need to install the vsftpd FTP service. This can be done by running the following command:
sudo apt-get install vsftpd -y
Step 2: Configuring vsftpd
Next, you need to open the vsftpd configuration file and uncomment certain lines. This can be done by running the following command:
sudo vi /etc/vsftpd.conf
You need to uncomment the following lines and add the last two lines:
write_enable=YES ascii_upload_enable=YES ascii_download_enable=YES chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list ls_recurse_enable=YES local_root=public_html seccomp_sandbox=NO
Step 3: Allowing User Access to Their Home Directory
To allow a user to access their home directory, you need to edit the vsftpd.chroot_list file. This can be done by running the following command:
sudo vi /etc/vsftpd.chroot_list
Then, add the user to the file:
geeks
Step 4: Restarting vsftpd
After making these changes, you need to restart vsftpd for the changes to take effect. This can be done by running the following command:
sudo initctl restart vsftpd
Step5: Verifying the FTP Port
To ensure that the FTP port is listening, you can run the following command:
telnet localhost 21
If the FTP port is listening, you will see a response similar to this:
Trying ::1... Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 (vsFTPd 3.0.2) ^] telnet> quit
Step 6: Testing from a Windows Client
Finally, you can test the FTP server from a Windows client. This can be done by running the following command:
ftp 192.168.0.114
You will be prompted to enter your username and password. After logging in, you can run the ‘pwd’ command to display the current directory:
User (192.168.0.114:(none)): geeks 331 Please specify the password. Password: 230 Login successful. ftp> pwd 257 "/home/geeks/public_html" ftp>
Commands Mentioned
- sudo apt-get install vsftpd -y – Installs the vsftpd FTP service
- sudo vi /etc/vsftpd.conf – Opens the vsftpd configuration file for editing
- sudo vi /etc/vsftpd.chroot_list – Opens the vsftpd.chroot_list file for editing
- sudo initctl restart vsftpd – Restarts the vsftpd service
- telnet localhost 21 – Checks if the FTP port is listening
- ftp 192.168.0.114 – Connects to the FTP server from a Windows client
FAQs
-
What is the purpose of the vsftpd FTP service?
The vsftpd FTP service is used to transfer files from one machine to another or to a server. It is particularly useful when managing your own VPS or dedicated server for hosting a blog or website.
-
What does the ‘write_enable=YES’ line do in the vsftpd configuration file?
The ‘write_enable=YES’ line in the vsftpd configuration file allows FTP users to write to the server, enabling them to upload files.
-
What is the purpose of the ‘chroot_local_user=YES’ line in the vsftpd configuration file?
The ‘chroot_local_user=YES’ line in the vsftpd configuration file confines FTP users to their home directories, preventing them from accessing other parts of the server’s file system for security reasons.
-
How can I check if the FTP port is listening?
You can check if the FTP port is listening by running the ‘telnet localhost 21’ command. If the port is listening, you will see a response indicating a successful connection.
-
How can I test the FTP server from a Windows client?
You can test the FTP server from a Windows client by running the ‘ftp’ command followed by the IP address of the server. You will be prompted to enter your username and password. After logging in, you can run commands like ‘pwd’ to display the current directory.
Conclusion
Setting up and configuring an FTP server is a crucial step in managing your own VPS or dedicated server. The vsftpd FTP service is a reliable and secure choice for this purpose. By following the steps outlined in this guide, you can successfully install and configure vsftpd on Ubuntu 14.04. Remember to always verify your setup by checking if the FTP port is listening and by testing the server from a client machine.
For a deeper understanding of the best web servers, you can visit here. If you’re interested in learning more about different types of servers like Apache, Nginx, and LiteSpeed, you can check out these links: Apache, Nginx, and LiteSpeed. To understand more about different hosting options, you can read about dedicated server, VPS server, cloud hosting, and shared hosting.
2 Comments
after doing the step 2.. how will i comeback to “ehowstuff@ubuntu14:~$” to type the syntax “sudo vi /etc/vsftpd.chroot_list” any help pls? 🙂
sudo nano /etc/vsftpd.chroot_list