In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
First, this afternoon, due to the requirements of the course, I had to do an experiment on Ubuntu to build a Ftp server, but the experimental instructions were still the technology of N years ago. I searched a lot of them on the Internet, and they were all vague!
In all kinds of difficulties finally succeeded in the experiment, I would like to share the experience with you in the hope that you will not take detours!
2. The detailed steps are as follows:
(1) first open the terminal and enter the root mode (enter: sudo su enter prompt for password in the terminal)
(2) install vsftpd software (first of all, connect to the network, or install it through Xinlide software! Uninstall software command: sudo apt-get remove vsftpd)
Command: sudo apt-get install vsftpd
(3) after the installation is successful, a ftp file (in the same level directory as home) will be created by default in the srv directory under the file system, which is the default folder of the ftp server!
(4) in some documents, it is said that the directory automatically created by the ftp server is the ftp folder under the home directory, but I never found it (usually the user's directory under the home directory), and I didn't find it when I visited ftp!
(5) to add folders and files to the server directory, first create a folder test under srv/ftp/ (cannot be created manually, only through commands! )
Command: mkdir / srv/ftp/test
Get the folder you created:
Create a few more directories for testing only!
(6) create a file in the test folder: touch / srv/ftp/test/1.txt file
(7) Edit the 1.txt file: (due to the management of permissions, you need to use root mode to change the contents of the file! )
Sudo gedit / srv/ftp/test/1.txt will pop up a notepad file that can only be modified if it is opened under root permissions. Add something casually.
(8) to illustrate a command, restart it!
The command is: sudo / etc/init.d/vsftpd restart
(9) check whether the IP address of Ubuntu has been found successfully. The person who visited me in the address bar is: ftp://192.168.136.130/ or ftp://localhost. The following is a screenshot:
Go to test and find the 1.txt file and click to enter!
(10) ok! It's done here!
Third, the above knowledge introduces the general default configuration, we usually need to configure according to our own needs, here are some common configurations!
If you need to modify it, you still need to modify the command under root permission: sudo gedit / etc/vsftpd.conf
(1) settings related to anonymous users
Anonymous_enable=YES, change YES to NO, forbid anonymous users to log in to # anon_mkdir_write_enable=YES, remove # comments, allow anonymous users to create directories # non_upload_enalbe=YES, remove #, allow anonymous users to upload anon_world_readable_only=YES, allow anonymous users to download, default is prohibited, this can be added by yourself. Anon_other_write_enable=YES, if you set it to YES, in addition to uploading and creating directories, you can also rename and delete files. The default is NOno_anon_password=NO, and set it to YES. Anonymous users will not query the user's password and log in directly. Ftp_username=ftp. The account number of anonymous users logging in to the system defaults to ftp. It is best not to change this item. Chroot_local_user=YES # restricts local users to their own home folders so that they cannot access files other than their own home after logging in. This is for security reasons. Anon_root=/var/ftp/anon # specifies the root folder after anonymous login, that is, for anonymous users, / var/ftp/anon is mapped to its root directory.
(2) designation of FTP service port
Listen_port=8021, specify command channel is 8021, default is 21listen_data_port=8020, specify data channel is 8020, default is 20
(3) setting of upload mode
Pasv_enable=YES, whether passive mode is allowed or not, is allowed by default. Pasv_min_port=10000, which specifies the minimum value pasv_max_port=10004 for opening the port when using passive mode, and the maximum value for opening the port when using passive mode.
(4) Vsftp server specifies IP address
Listen_address=192.168.0.21, specify the FTP,IP address
Note: the specified IP is only allowed if the vsftp is running in stand-alone mode, and if the vsfpd file has been created in the / etc/xinetd.d directory, set the disable in the file to yes.
(5) Lock the user and prohibit the user from leaving the user's home directory
Chroot_local_user=YES, set it to YES, lock it in the user's home directory, set it to NO, and switch it.
Sets the specified user to lock the user home directory:
# chroot_list_enable=YES#chroot_list_file=/etc/vsftpd.chroot_list
Change it to the following:
Chroot_list_enable=NOchroot_list_file=/etc/vsftpd/vsftpd.chroot_list
Save the above and do the following:
# touch / etc/vsftpdvsftpd.chroot_list#vi / etc/vsftpd/vsftpd.chroot_list, add the user list to the file, such as netseek_com
(6) flow control of vsftpd server
Max_clients=100; the maximum number of connections allowed is defined as 100,0 by default, and there is no limit to the table max_per_ip=5; the number of connections allowed per IP is unlimited and needs to be run in independent mode before anon_max_rate=50000; maximum bandwidth for anonymous users (in bpslocal_max_rate=200000); maximum bandwidth for system users
(7) vsftpd customized welcome message
Catalog description Settings
# vi / etc/vsftpd.conf#dirmessage_enable=YES, the preceding # is removed.
Then we customize a .message, write down what you want to write, and then copy the file to each user's home directory, just OK.
(9) Welcome message settings for vsftpd system
Ftpd_banner=Welcome to ftp.netseek.com, Yeah!!!
System Welcome message File Settings
Banner_file=/etc/vsftpd/welcome is similar to ftpd_banner, except that banner_file specifies a welcome file.
Fourth, create users
But you can't upload files like this. Because this is an anonymous user, the current directory owner is a root user; you really want to upload files and set up a folder under this directory such as upload
$sudo mkdir / srv/ftp/upload$ sudo chown ftp:root / srv/ftp/upload
At this time, you can upload files to the upload directory, but the root directory still cannot upload files. This is an anonymous user. If it is not an anonymous user, this problem does not exist.
1)。 Modify configuration file / etc/vsftpd.conf
Anonymous_enable=NOlocal_enable=YESwrite_enable=YESchroot_local_user=YES
2)。 Create a local user
$sudo useradd ftpuser-m $sudo passwd ftpuser
You can log in to FTP with ftpuser.
6. If there is an error: 500OOPS: vsftpd: refusing to run with writable anonymous root
This means that the permissions of the ftp user's home directory are incorrect, and the permissions of this directory cannot be opened; it is due to running chmod 777 / srv/ftp; if you do not have the home directory of the ftp user, of course you have to create one yourself.
The home directory of FTP users cannot be completely open to all users, user groups and other user groups. The solution is as follows:
# chown root:root / srv/ftp # chmod 755 / srv/ftp
7. The firewall opens the corresponding port 21.
8. / etc/init.d/vsftpd restart restart the service
5. Explanation of each user
Here's how vsftpd supports three types of users:
1. Anonymous users, that is, users who can log in to the ftp server without entering a password, this user name is usually ftp or anonymous;. Settings related to anonymous users often start with the anon_ option. two。 Local users, that is, users on your Linux system who can log in to the system, are real users on the system. Usually have their own home,shell and so on. Settings related to local users often start with local_ or contain options for local_. 3. Virtual users, only valid for ftp users. These users cannot log in to the Linux system, only the ftp server. In fact, a local user is mapped to multiple virtual users that are only valid for the ftp server. Virtual users can have their own ftp configuration files, so virtual users are usually used to establish different permissions for different users of the ftp system in order to achieve the purpose of security control. Settings related to virtual users start with guest_.
If you just want to share yourself with ftp, you can turn on local users.
If you want to share with a lot of people, you can use anonymous users.
If you need to give different permissions to different user groups, you need to set up more complex virtual users.
Mkdir directory name = > create a directory
Rmdir empty directory name = > Delete an empty directory
Rm filename filename = > Delete one or more files
Rm-rf non-empty directory name = > Delete everything under a non-empty directory
Touch file name = > create an empty file
Summary
The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support. If you want to know more about it, please see the relevant links below.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.