Tutorial to install FTP server on Ubuntu server

Before the company with a server, installed on the server FTP Server. At that time, I also organized a document, and now I put it here for backup.

This article mainly describes how to install FTP server on UBUNTU Server system.
1. Basic information:
1) The server ip is 192.168.1.164
2) The OS version of the server is Ubuntu 12.04
3) There are many kinds of ftp software, the software used by this server is vsftpd

2. Open the terminal, first run "sudo apt-get update" to complete the update. If you do not run this command and install vsftpd directly, there may be an error message like "several packages cannot be downloaded, you can run apt-get update------", resulting in failure to install.

3. Install vsftpd
run sudo apt-get install vsftpd

4. To check whether FTP is really installed successfully
, run sudo service vsftp restart; if the result is as follows:
vsftp stop/waiting
vsftp start/running, process 6424
means the installation is successful.

5. Create the /home/uftp directory as the user's home directory
and run sudo mkdir /home/uftp in the terminal

6. Add users and set passwords.
1) Run sudo useradd -d /home/uftp -s /bin/bash YuRen in the terminal to create the user YuRen.
2) After the user is created successfully, run sudo passwd YuRen to set the password. Enter the password twice in a row, the password is set successfully.

7. Modify the configuration file
1) Enter /etc/vsftp.conf. The vsftp configuration file is sensitive, and the number of spaces can sometimes make the configuration error, so that ftp cannot run normally, so first use cp vsftp.conf vsftp.conf1 to back up the configuration file, and then you can safely modify vsftp.conf
2) In The vsftp.conf is configured as follows. Note: a) Each line of configuration is placed at the beginning of each line without spaces. b) There cannot be spaces at both ends of "=".

listen=YES

anonymous_enable=NO

local_enable=YES

write_enable=YES

local_umask=022

dirmessage_enable=YES

use_localtime=YES

xferlog_enable=YES

connect_from_port_20=YES

xferlog_file=/var/log/vsftpd.log

xferlog_std_format=YES

ftpd_banner=Welcome to Ewaybot FTP service.

secure_chroot_dir=/var/run/vsftpd/empty

pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem
userlist_deny=NO
userlist_enable=YES
userlist_file=/etc/allowed_users
local_root=/home/uftp

8. Modify the permissions of the /home/uftp folder
1) Run sudo chmod 777 /home/uftp to modify the permissions of the folder.

9. Create the allowed_users file
1) Create the allowed_user file in /etc. Use the touch allowed_user command.
2) Open the allowed_user file and add the user created in step 6 to it.

10. Restart the ftp service
1) Run sudo service vsftp restart to make the new configuration take effect.

After completing the above configuration, the ftp server configuration is complete.

Then we run the terminal on the client and run ftp 192.168.1.164 on the client to connect to FTP normally.
After the connection is successful, the following display will appear:
YuRen@YuRen-ThinkPad-E460:~$ ftp 192.168.31.164
Connected to 192.168.31.164.
220 Welcome to Ewaybot FTP service.
Name (192.168.31.164:YuRen):
Enter the user name and press Enter.
331 Please specify the password.
Password:
Enter the password and press Enter.
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
If the above message is displayed, you can use FTP to upload and download normally.


The common operation commands of the ftp client are as follows:
ascii transmits data in ASCII mode;
binary transmits data in binary mode, which must be used for the transmission ratio of executable programs;
ls displays the directory list of the ftp server;
cd changes the directory;
lcd changes the local directory ;
get downloads files to this machine;
put uploads files to ftp server;
quit/bye exits;
? Display local help information.

 

There will be some problems in the actual installation and use. The specific problems and solutions are as follows.


Supplementary FAQs:
1) Don't log in anonymously. There are many pitfalls in anonymous configuration files, which are prone to problems. Therefore, in the configuration file, try to comment out the anonymous related configuration and use the local user.
2) If it is found that the FTP is different, the common methods are as follows:
a) Use the ping command first to see if the server can be pinged.
b) If you can ping, then use netstat -ntl to see if port 21 is open. The FTP protocol occupies ports 20 and 21 of the TCP/IP protocol suite, where 20 is used to transmit data and 21 is used to establish a connection. Verifying that port 21 exists indicates that FTP has indeed established a network connection.
3) Run sudo service vsftp status to check the status of ftp. If it is found that it is not in vsftp start/running status, it means that the ftp service is not running normally. In most cases the vsftp.conf file is misconfigured, find and modify the file.
4) If there is an error in FTP during use, you can locate it by viewing the log information. The log information is stored in /var/log/vsftpd.log, and the detailed information of the log can be seen by viewing this file.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325266144&siteId=291194637