How to Create an FTP User in Ubuntu? [Step-by-Step]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

 FTP is the short form of File Transfer Protocol. In Ubuntu, sometimes we might need to transfer files from one computer to another computer. FTP server is a convenient tool to do this transferring task. You need to specify an FTP user through which you will access the FTP server. Using the FTP server makes Ubuntu a more user-friendly and resource-sharing platform. In this article, I will discuss how to create an FTP user in Ubuntu.

Key Takeaways

  • Getting familiar with the FTP server and FTP user.
  • Getting familiar with the process of transferring files from the FTP server computer to the client computer and vice versa.

Requirements

  • A server computer for hosting the FTP
  • A client computer for using as a client as a part of this tutorial.
  • To add an FTP user or install VSFTP, you need to be a root user or have root/sudo privileges

Process Flow Chart

Distro Used Throughout the Tutorial: Ubuntu 22.04.1 LTSProcess flowchart of creating FTP user in ubuntu.

Watch 2 Steps to Create FTP User & Server and Access It from the Client Computer in Ubuntu

2 Steps to Create FTP User & Server and Access It from the Client Computer in Ubuntu

In this guide, at first, I will create a user and set up an FTP user from a server computer which is Ubuntu installed in VMware. Then access this FTP user from a client computer which is Ubuntu installed in Windows.

Step 1: Create an FTP User and an FTP Server in Ubuntu

At first, I will create a user then set up an FTP server, and get the IP address of that FTP server. To do so, follow the below procedures.

Steps to Follow >

➊ At first, open the Ubuntu terminal.

➋ Then copy the following command into the terminal and press the ENTER button.

sudo adduser ftp_user
EXPLANATION
  • sudo: Grants root privileges.
  • adduser: Creates a new user.
  • ftp_user: Name of the user.

Creating a FTP user.➋ Now, ENTER the currently logged-in user password, set a password for the new user, and enter other details of the new user.

➌ Afterwards, type the following command into the terminal then press ENTER to update the repository.

sudo apt-get update
EXPLANATION
  • sudo: Grants root privileges.
  • apt-get update: Updates the local repository.
Updating the repository package.➍ Now, type the following command into the terminal then press the ENTER button to install vsftpd.

sudo apt-get install vsftpd
EXPLANATION
  • sudo: Grants root privileges.
  • apt-get install: Install the given package.
  • vsftpd: A popular open-source FTP server package.

Installing the vsftpd package.➎ Now, type the following command into the terminal then press the ENTER button to open the vsftpd.conf file to add or modify some lines.

sudo nano /etc/vsftpd.conf
EXPLANATION
  • sudo: Grants root privileges.
  • nano: Opens a file in the Nano text editor.
  • /etc/vsftpd.conf: Configuration file for “vsftpd”.
Opening the vsftpd.conf file.Now, add the commands given below to the opened file

write_enable=YES
pasv_min_port=40000
pasv_max_port=60000

Necessary edit of the vsftpd.conf file.Note: If these lines prevail inside the /etc/vsftpd.conf file, remove # before these lines on the opened file. Do not do both.

EXPLANATION
  • write_enable: Determines whether users are allowed to upload files or not.
  • pasv_min_port: Specifies the minimum port for passive mode.
  • pasv_max_port: Specifies the maximum port for passive mode.

➏ Now, type the following command into the terminal then press the ENTER button.

sudo ufw allow 20/tcp
sudo ufw allow 21/tcp
sudo ufw allow from any port 40000:60000 proto tcp
EXPLANATION
  • sudo: Grants root privileges.
  • ufw: Firewall of Ubuntu.
  • allow: Allows incoming traffic on a given port.
  • 20/tcp: Port 20 with TCP protocol used to transfer files in active mode.
  • 21/tcp: Port 21 with TCP protocol allows the server and client to communicate from any port to any port 40000:60000 proto tcp: Allows traffic from port 40000 to port 60000.
Executing command to enable the port.➐ Then, type the following command into the terminal and press the ENTER button.

sudo systemctl restart vsftpd
sudo systemctl status vsftpd
EXPLANATION
  • sudo: Grants root privileges.
  • systemctl: Controls system services.
  • restart: Restarts a system service.
  • status: Shows the current status of service.
  • vsftpd: Name of the FTP service.
Restarting the vsftpd then find the status of the vsftpd.➑ Now, type the following command into the terminal then press ENTER to know the IP address of the FTP server.

Ifconfig
EXPLANATION
  • ifconfig: Displays network interface parameters including IP address.
Note: If your system doesn’t have “ifconfig”, use the following command to install it

sudo apt-get install net-tools
Printing the IP address of the FTP server.In the above image, you can see that the IP address of the FTP server is 192.168.159.128



Step 2: Access the FTP server from a Client Computer in Ubuntu

Here I will access the FTP server created in the previous step through the “ftp_user” user from the client computer which is Ubuntu installed in windows. To achieve so, follow the below procedures.

Steps to Follow >

➊ At first, open Ubuntu on your client computer.

➋ Then, type the following command into the terminal and press the ENTER button.

ftp [email protected]
EXPLANATION
  • ftp: Connects with the FTP server.
  • ftp_user: The user through which connection is established with the FTP server computer.
  • 168.159.128: IP address of the FTP server computer.

➌ Now, type the following command into the terminal and press the ENTER button to print the current working directory.

pwd
EXPLANATION
  • pwd: Prints the current working directory.
Accessing the FTP server through the ftp_user user.The above image shows that I have successfully accessed the FTP server through the ftp_user user.



Complementary Information

Besides, knowing how to create an FTP user in Ubuntu, you will find the below information helpful.

Access Files from an FTP Server in Ubuntu

You can easily transfer a file from the FTP server computer to the client computer. Here, I have a file named sample.txt on the desktop folder of the server. Now, I will transfer this file from the FTP server computer to the client computer. To do so, follow the steps given below.

Steps to Follow >

➊ At first, open Ubuntu on your client computer.

➋ Then, type the following command into the command prompt and press the ENTER button

ftp [email protected]
EXPLANATION
  • ftp: Connects with the FTP server.
  • ftp_user: The user through which connection is established with the FTP server computer.
  • 168.159.128: IP address of the FTP server computer.

➌ Now, type the following command into the terminal and press the ENTER button.

cd Desktop
EXPLANATION
  • cd: Changes the directory.
  • Desktop: Destination directory.

➍ Then, type the following command into the command prompt and press the ENTER button.

pwd
EXPLANATION
  • pwd: Prints the current working directory.

➎  Then, type the following command into the command prompt and press the ENTER button.

cd /home/ftp_user/Desktop
EXPLANATION
  • cd: Changes the directory.
  • /home/ftp_user/Desktop: Absolute path of the destination directory.

➏  Afterwards execute the following command into the command prompt.

ls -l
EXPLANATION
  • ls: Prints the contents of the current directory.
  • -l: Prints the reading, writing, and executing permission information, number of hard links, owner, group, size, and last modification time of all contents of the current directory.

➐  Then, run the following command into the command prompt.

get sample.txt
EXPLANATION
  • get: Fetches the following file.
  • txt: The transferred file.

➑  Now, type the following command into the command prompt and press the ENTER button.

exit
EXPLANATION
  • exit: Exits from the FTP server.

➒  Then, type the following command into the command prompt and press the ENTER button.

ls
EXPLANATION
  • ls: Prints the contents of the current directory.

The below image shows that I have successfully transferred a file named sample.txt from the server computer to the client computer.Transferring a file from the server computer to the client computer.



Upload Any File to the FTP Server Computer from the Client Computer in Ubuntu

You can easily upload a file from the client computer to the server computer.client_file.txt on the client computer.Here I have e file named client_file.txt on the client computer. I will now upload that file from the client to the server. To achieve so, follow the below procedures.

Steps to Follow >

➊ At first, open Ubuntu on your client computer.

➋ Now, type the following command into the terminal and press the ENTER button to log in to the FTP server as ftp_user.

ftp [email protected]
EXPLANATION
  • ftp: Connects with the FTP server.
  • ftp_user: The user through which connection is established with the FTP server computer.
  • 168.159.128: IP address of the FTP server computer.

➌ Then, type the following command into the terminal and press the ENTER button to upload the client_file.txt to the server computer.

put client_file.txt
EXPLANATION
  • put: Transfer the file to the FTP server.
  • client_file.txt: The transferred file.

Transferring a file from the client computer to the FTP server computer.The above image shows that I have successfully transferred the client_file.txt file from the client computer to the server computer.

Now, to verify whether the file is uploaded on the server computer first, open the Ubuntu terminal on the server computer. Now, type “ls -l” on the command prompt then press the ENTER button.

EXPLANATION
  • ls: Prints the contents of the current directory.
  • -l: Prints the reading, writing, and executing permission information, number of hard links, owner, group, size, and last modification time of all contents of the current directory.

The client_file.txt on the server computer.From the above image, you can see that I have successfully transferred the client_file.txt file from the client computer to the server computer.

Conclusion

In this article, I have shown the procedures to create an FTP user for an FTP server. As complementary information, I have shown the procedures for transferring any file from the FTP server computer to the client-server and vice versa. I hope after going through this article, you will be successful to get your necessary information and be productive enough to create an FTP server and access it through an FTP user.

People Also Ask

What is an FTP user in Linux?
The File Transfer Protocol (FTP) is a process to transfer a file from one computer to another computer. Here, the FTP user is the user who can access the FTP server.
What is the default FTP user in Ubuntu?
All user of the server is the FTP user but the default FTP users are root, daemon, nobody, etc.
How do I find FTP user permissions?
To find and modify the permissions, connection details, and limits of an FTP user first access the server preferences in server functions > FTP configuration. Then click on the name of the user you want to modify from the FTP users tab. Now click on the permissions report. Thus the user permissions for all FTP sites are listed.
How do I log in as an FTP user?
To log in to an FTP user, Type “ftp username@ip_address” on the command prompt then press the ENTER button. After giving the password it will give access to that FTP server
How do I create a new user in Linux?
To create a new user in Linux, you need to type the “sudo adduser user_name” command into the terminal and then press the ENTER button. The prerequisite is you have to be a root user to run this command in Ubuntu.
Why can't I access FTP?
It happens when your FTP is not working appropriately, or something on your computer (such as a firewall or other security software) is not permitting the FTP connections.
What are FTP permissions?
FTP permissions are the settings mode on the FTP server that allows a user to perform a certain task when they have logged in.

Related Articles

Rate this post
Susmit Das Gupta

Hello everyone. I am Susmit Das Gupta, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Mechanical Engineering graduate from Bangladesh University of Engineering and Technology. Besides my routine works, I find interest in going through new things, exploring new places, and capturing landscapes. Read Full Bio

Leave a Comment