Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and use FTP server on Linux

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to install and use FTP server on Linux". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to install and use FTP server on Linux.

Linux VPS users generally use SFTP/SCP protocol to connect OpenSSH Server for file transfer, but sometimes you want some users to only upload files to the website directory, but not log in to the system to execute commands and access other directories, then you can use FTP Server to achieve. FTP Server commonly used on Linux are VSFTPD and ProFTPD, of which ProFTPD is easy to use and has good functions. Here we take ProFTPD as an example to build a FTP server. Of course, FTP can also be used as a way of file sharing on your local area network. For example, your roommate uses Windows to upload a movie to your Ubuntu ProFTPD PC, so that you don't have to use a flash drive to copy it, and other roommates can download movies from your ProFTPD.

Proftpd is configured in a way similar to apache and is easier to use than vsftpd, so xampp integrates proftpd.

The code is as follows:

Sudo apt-get install proftpd-basic

When installing, proftpd runs as a standalone server by default. If there are few ftp requests every day, it can be installed as an inetd service to save server resources.

Here I use the default value, which is installed as standalone server.

The code is as follows:

Sudo netstat-antp | grep proftpd

View port 21 monitored by proftpd

Create a new virtual user test with the ftpasswd provided by proftpd and set the password:

The code is as follows:

Sudo mkdir-p / png/proftpd

The code is as follows:

Sudo ftpasswd\

-- passwd\

-- file=/png/proftpd/passwd\

-- name=test\

-- uid=122\

-- gid=65534\

-- home=/srv/ftp\

-- shell=/bin/false

Among them, uid and gid I use the uid and gid of the system user ftp:nogroup created automatically when installing proftpd, execute cat / etc/passwd | grep ftp is visible.

/ srv/ftp is the directory that is automatically created when you install proftpd. The owner is ftp:nogroup and the permission is 755. 0.

In this way, the virtual user test can read and write to the directory by logging in / srv/ftp as the system user ftp:nogroup.

The read and write permissions of FTP Server on Linux are mapped to the system UGO (User Group Other).

When creating virtual users, the read and write control is realized by setting system users uid and gid, and reasonably configuring the / srv/ftp directory and its file permissions.

When creating a new user, execute the above command again and change some parameters as needed.

For example, I created a virtual user eechen that runs with a uid:gid of 1000 eechen 1000 and a login directory of / user:

The code is as follows:

Sudo ftpasswd\

-- passwd\

-- file=/png/proftpd/passwd\

-- name=eechen\

-- uid=1000\

-- gid=1000\

-- home=/png/www/example.com\

-- shell=/bin/false

You do not need to overload proftpd to create a user, because proftpd reads the authentication file each time it authenticates.

The code is as follows:

Sudo chown proftpd:nogroup / png/proftpd/passwd set passwd file read and write permissions to ensure that proftpd can read the file.

The code is as follows:

Sudo nano / etc/proftpd/proftpd.conf

Add at the end:

The code is as follows:

DefaultRoot ~ # limits users to their own directories, and the above test users correspond to / srv/ftp

RequireValidShell off # disable Shell request authentication

AuthOrder mod_auth_file.c # authentication method sequence. File authentication is used here.

AuthUserFile / png/proftpd/passwd # files that store usernames and passwords

The code is as follows:

Sudo service proftpd reload

Overloading makes the configuration effective.

Change the default port of proftpd

Find it in the file / etc/proftpd.conf:

The code is as follows:

Port 21

Change to:

The code is as follows:

Port 2121

If iptables,iptables is enabled and all outbound ports are restricted, load the module ip_conntrack_ftp, and you need to change the proxy port to 2121 when loading the ip_conntrack_ftp module.

Open / etc/sysconfig/iptables-config and make sure that the file definition loads ip_conntrack_ftp, such as:

The code is as follows:

IPTABLES_MODULES= "ip_conntrack_ftp"

Then add the parameters of this module to the file / etc/modprobe.conf:

The code is as follows:

Options ip_conntrack_ftp ports=2121

If you need to load manually, you can execute the following command:

The code is as follows:

/ sbin/modprobe ip_conntrack_ftp ports=2121

At this point, I believe you have a deeper understanding of "how to install and use FTP server on Linux". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 251

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report