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 LTS
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
➋ 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
- sudo: Grants root privileges.
- apt-get update: Updates the local repository.
sudo apt-get install vsftpd
- sudo: Grants root privileges.
- apt-get install: Install the given package.
- vsftpd: A popular open-source FTP server package.
sudo nano /etc/vsftpd.conf
- sudo: Grants root privileges.
- nano: Opens a file in the Nano text editor.
- /etc/vsftpd.conf: Configuration file for “vsftpd”.
write_enable=YES
pasv_min_port=40000
pasv_max_port=60000
Note: If these lines prevail inside the /etc/vsftpd.conf file, remove # before these lines on the opened file. Do not do both.
- 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
- 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.
sudo systemctl restart vsftpd
sudo systemctl status vsftpd
- 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.
Ifconfig
- ifconfig: Displays network interface parameters including IP address.
sudo apt-get install net-tools
- How to Create a Jenkins User on Ubuntu? [2 Methods]
- How to Create MySQL User in Ubuntu? [2 Cases]
- Create User Without Home Directory in Ubuntu in Just 3 Steps
- How to Create a User in Docker Container Without Docker File?
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]
- 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
- pwd: Prints the current working directory.
- How to Create a Root User in Ubuntu [Step-by-Step]
- Create a New SFTP User in Ubuntu with a New SSH Key
- How to Create Group and Add User in Ubuntu? [2 Cases]
- Create FTP User for Specific Directory in Ubuntu [4 Steps]
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]
- 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
- cd: Changes the directory.
- Desktop: Destination directory.
➍ Then, type the following command into the command prompt and press the ENTER button.
pwd
- 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
- 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
- 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
- get: Fetches the following file.
- txt: The transferred file.
➑ Now, type the following command into the command prompt and press the ENTER button.
exit
- exit: Exits from the FTP server.
➒ Then, type the following command into the command prompt and press the ENTER button.
ls
- 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.
- How to Create Multiple Users in Linux? [2 Methods]
- Create a User in Ubuntu as Read-Only Access to Log Folder
- How to Create User Account in Ubuntu with Public Key
- Create A User in Ubuntu that Runs a Script and Logs Out [4 Steps]
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.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]
- 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
- put: Transfer the file to the FTP server.
- client_file.txt: The transferred file.
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.
- 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.
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
Related Articles
- How to Create User and Add to Sudo in Ubuntu? [2 Methods]
- 2 Ways to Create a User With Access to a Drive in Ubuntu
- How to Create a New User in Ubuntu by GUI? [Step-by-Step]
- 2 Ways to Create User Account in Ubuntu Using Terminal
- How to Create Home Directory for Existing User in Ubuntu
- Create User with UID and GID in Ubuntu? [3 Scenarios]
- How to Create a Sudo User in Ubuntu? [Step-by-Step]
FUNDAMENTALS A Complete Guide for Beginners