Setting up an FTP server on CentOS 7 is a straightforward process that can be completed in just a few steps. File Transfer Protocol (FTP) is a popular protocol used to transfer files between systems. It is commonly used in web development to upload and download files to and from a web server.
In this article, we will guide you through the process of setting up an FTP server on CentOS 7.
Before we begin, ensure that you have a CentOS 7 server up and running with root access.
Step 1: Install vsftpd
The first step is to install vsftpd, a lightweight and secure FTP server for Unix-like systems. To install vsftpd, run the following command:
sudo yum install vsftpd
Step 2: Configure vsftpd
After installing vsftpd, the next step is to configure it. Open the vsftpd configuration file using your favorite text editor:
sudo vi /etc/vsftpd/vsftpd.conf
Uncomment the following lines to allow anonymous FTP access:
anonymous_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
To restrict anonymous FTP access, change the following line:
#anon_root=/var/ftp/pub
To:
anon_root=/var/ftp
Save and exit the configuration file.
Step 3: Configure Firewall
If you have enabled the firewall on your server, you need to allow FTP traffic through the firewall. Run the following command to open the FTP port (port 21):
sudo firewall-cmd --add-port=21/tcp --permanent
sudo firewall-cmd --reload
Step 4: Start vsftpd
The last step is to start the vsftpd service:
sudo systemctl start vsftpd
sudo systemctl enable vsftpd
Congratulations! You have successfully set up an FTP server on your CentOS 7 server.
Additional Tips
- To create new FTP users, run the following command:
sudo useradd -m ftpuser
sudo passwd ftpuser
- To change the default FTP directory, modify the following line in the vsftpd configuration file:
#local_root=/var/ftp/pub
To:
local_root=/home/user/ftp
- To allow FTP access for a specific user, modify the following line in the vsftpd configuration file:
userlist_deny=YES
To:
userlist_deny=NO
Then, create a userlist file and add the allowed users:
sudo vi /etc/vsftpd/user_list
Add the username to the userlist file:
ftpuser
Save and exit the file.
Related Searches and Questions asked:
That's it for this post. Keep practicing and have fun. Leave your comments if any.
0 Comments