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 solve the problem of ftp environment configuration

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

Editor to share with you how to solve the problem of ftp environment configuration, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's learn about it!

1. Install vsftpd components

Installation command: [root@ink4t ~] # sudo apt-get install vsftpd

After installation, there is a / etc/vsftpd/vsftpd.conf file, which is the configuration file for vsftp.

2. Add a ftp user

This user is used to log in to the ftp server.

[root@ink4t ~] # useradd ftpuser

After such a user has been built, you can log in with this. Remember to log in normally instead of anonymously. The default path after login is / home/ftpuser

3. Add a password to the ftp user

[root@ink4t ~] # passwd ftpuser

Change the password after entering the password twice.

4. Firewall opens port 21.

Because the default port of ftp is 21, and centos is not open by default, modify the iptables file.

[root@ink4t ~] # vi / etc/sysconfig/iptables

There is 22-j ACCEPT on the top of the line and another line of input is similar to that line, but change 22 to 21, and then: wq save.

To run it, restart iptables.

[root@ink4t ~] # service iptables restart

5. Modify the configuration file vsftpd.conf

Allow anonymous users to access, and restrict anonymous users' directories to / home/ftpuser

Anonymous_enable=YES anon_root=/home/ftpuser

Specifically, the / home/ftp directory cannot have w permission, this is a read-only directory, otherwise an error will be reported. Modify permissions can be used

Sudo chmod a murw / home/ftpuser

Local users can access and have write permission

Local_enable=YES write_enable=YES

Local users are limited to their own home directory after logging in, and users who do not have to restrict directories are specified through the file / etc/vsftpd.chroot_list (for example, our user1 does not have to restrict directories, so write user1 under this file), while allowing users to modify their own home directories.

Chroot_local_user=YES chroot_list_enable=YES chroot_list_file=/etc/vsftpd.chroot_list allow_writeable_chroot=YES

Enable the user list, and users who are not in the list are prohibited from logging in (so we will write user1,user2,anonymous,ftp in the etc/allowed_users, where the last two indicate anonymous login)

User_list_enable=YES user_list_deny=NO userlist_file=/etc/allowed_users

This is an empirical item that is configured to avoid some errors, as described in the references.

Seccomp_sandbox=NO

At this point, we also noticed that two files are involved, one is / etc/vsftpd.chroot_list and the other is / etc/allowed_users. We need to create these two files manually after we have saved them.

Sudo touch / etc/vsftpd.chroot_list sudo touch / etc/allowed_users

Then the user in / etc/vsftpd.chroot_list is not restricted to the directory. In this example, we want to write in user1,/etc/allowed_users the user who is allowed to access the server, here is user1,user2, and the anonymous user anonymous,ftpuser, notice that only one user name is written on each line.

The above is all the contents of the article "how to solve the problem of ftp environment configuration". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

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: 0

*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