File sharing server FTP

Table of contents

1. Configuration

 2. Introduction to configuration files 

 3. Operational procedures and common problems

1. Anonymous users

 2. Local users

 4. Simulation Experiment Questions

 1. Set up the ftp service, set it so that anonymous users cannot log in, and verify it

 2. When logging in, local users can only operate in the root directory and cannot switch directories.

 3. Set anonymous users to be able to create directories but cannot delete directories.

 4. Set a1 user to be unable to log in to the ftp server


1. Configuration

1. First create a virtual machine named FTP server, and then create a client named FTP

2. Then configure YUM source, tolerance mode, turn off the firewall, graphics, set IP, install vsftpd software on the server, restart the client and install ftp software on the two machines! Note: Install ftp on the client, otherwise you cannot use the ftp command!

3. Server environment configuration

(1) Configure yum after entering 

 (2) Mount the optical drive

(3) Turn off the firewall and graphics

 (4) Set tolerance mode

 

 After entering, change enforcing to disabled

 (5) Configure IP address

(6) Change files

 

(7) Restart the service and install vsftpd

 

 (8) The server environment is configured. The FTP client environment is the same as the above steps. You only need to change the IP address 192.168.100.1 to 192.168.100.2!

(9) Restart the network cards of the server and client to see if they can ping each other.

 (10) View the configuration file after installation

rpm -qc vsftpd 

 2. Introduction to configuration files 

vim /etc/dhcp/dhcpd.conf

Enter to enter the configuration file interface

(1) anonymous_enable=YES whether to enable anonymous user login

(2) local_enable=YES local user login

(3) write_enable=YES whether to allow writing

(4) What is the inverse code of local_umask after the user uploads the file?

(5) anon_upload_enable=YES whether to allow anonymous users to upload files

 3. Operational procedures and common problems

1. Anonymous users

(1) When entering ftp 192.168.100.1 in the client, if the connection is refused, it means that the server has not started yet.

Enter netstat -anptl to check whether the service is started 

 

 If it is not started, enter systemctl restart vsftpd to start. After starting, verify again and find that port 21 appears.

(2) Return to the client to connect again and the connection will be successful.

 (3) If you do not understand the prompt, identify the keywords

          means connect 100.1

Enter your user name

  password

Login successful ( if the interface is not 230, you will also enter this interface but fail to connect successfully, please note)

 

 (4) ls view pub is a public area location in cd /var/ftp

 

 Create a 1.txt at the location of pub on the server           

 Then the client is able to successfully access

 Note: Generally, download files are not created under ftp. Some permission issues will affect ftp. The results of uploading or downloading to pub under ftp will not affect ftp itself.

 (5) Enter cd pub in the client. It will prompt that the directory has been changed successfully.

If you create a file under this path, you will be prompted for permission denial, and the connection has a time limit.

 (6) Input on the client? View currently available operating commands

delete delete get download put push/upload quit exit

(7) Open a new terminal touch 2.txt. After the following is successful, return to the second terminal ls to verify that two .txt appear.

 Go back to the first terminal and enter get 1.txt. If Transfer is displayed, it is successful. 

 

 So far it says that you can download but not upload.

(8) Solve the upload problem and return to the server vim /etc/vsftpd/vsftpd.conf to enter the configuration file

Uncomment the content here (whether to allow uploading, enable it) 

 Save, exit and restart the service

 (9) After restarting, you need to log out and log in again when returning to the client (the error is still reported)

        Could not create file Could not create file

 Enter the configuration file, uncomment anon_mkdir_write_enable=YES, and restart the service.

(10) Continue to restart the client to verify the upload and creation and still report errors.

(11) Permission problem. Return to the server and enter ll under ftp to check the permissions.

And enter chmod 777 pub/ and chown -R ftp.ftp pub/ to change permissions and owner group and ls to view

 (12) Verify again

 Successfully created and uploaded   

(13) If you want to delete it, an error will be reported.

 Add a line yourself to the server's configuration file 

 (14) Return to the client and log in again to delete successfully.

 2. Local users

 (1) Enter tail -2 /etc/passwd to view the user name

 (2) View path pwd

 (3) The server switches to ordinary users 

Go back to the client ls to view

 

 (4) Both the server and the client exist. Which one is used by mpy is easy to confuse.

 (5) Create a zhangsan on the server

 (6) The server creates zhangsan, but the client can still log in without entering zhangsan. This means that the client can log in normally who is on the server.

(7) Now you can switch at will but it is not safe

 In order to prevent him from switching and modifying servers at will

 Comment out the original changes

Enter local_root=/var/ftp the local user’s FTP root directory. Save and restart the service.

(8) First download the ftp that is already under var, but you can still move the position, which is relatively unsafe.

 

(9) When changing a configuration item 

 (10) Confining only the host directory has the following effects

second terminal

 

Unable to create

 (11) Uncomment and restart the service

 Return to the client and upload successfully

 4. Simulation Experiment Questions

 1. Set up the ftp service, set it so that anonymous users cannot log in, and verify it

Configure the environment first

 

 2. When logging in, local users can only operate in the root directory and cannot switch directories.

Return to the client and log in again

 3. Set anonymous users to be able to create directories but cannot delete directories.

 

 4. Set a1 user to be unable to log in to the ftp server

 

 Verification successful

Guess you like

Origin blog.csdn.net/Mapinyi666/article/details/131766059