Add FTP account under linux

1. Start the VSFTP server

A: run under cenos: yum install vsftpd


B. After logging in to the Linux host, run the command: "service vsftpd start"

C. To enable FTP to start automatically every boot, run the command: "chkconfig --level 35 vsftpd on"


 
2. Set FTP permissions


A. Edit the VSFTP configuration file and run the command: "vi /etc/vsftpd/vsftpd.conf"

B. Change the "anonymous_enable=YES" in the configuration file to "anonymous_enable=NO"

C. Save the changes, press the ESC key, and run the command :":wq"
 

This turns off the anonymous login feature.


 
3. Add FTP account

A. After logging in to the Linux host, run the command: "useradd ftpadmin -s /sbin/nologin ". The account path points to the /home/ftpadmin directory by default; if you need to point the user to another directory, please run the command: useradd ftpadmin -s /sbin/nologin –d /www (other directory)

B. Set the ftpadmin user password and run the command:” passwd ftpadmin" ; Enter the password twice, after the match is successful, the password of the ftpadmin user is set.  C. To test the connection, you can enter ftp://IP 

in the "My Computer" address bar to connect to the FTP server, and enter the account password as prompted.

 
 
4. Precautions for FTP data transfer

A. 尽量把文件打包后上传。Linux无法识别RAR压缩包,可以使用ZIP压缩。

B.上传数据时请选择二进制编码,如果选择其他编码,可能会导致上传的压缩包无法打开。


 

centos FTP 用户指定目录禁用上级目录

In the default configuration, local users can use the cd command to switch to other directories after logging in to FTP, which will bring security risks to the system. The following three configuration files can be used to control user switching directories.
chroot_list_enable=YES/NO (NO)
Set whether to enable the user list file specified by the chroot_list_file configuration item. The default value is NO.
chroot_list_file=/etc/vsftpd.chroot_list
is used to specify the user list file, which is used to control which users can switch to the upper-level directory of the user's home directory.
chroot_local_user=YES/NO (NO)
is used to specify whether users in the user list file are allowed to switch to the upper directory. The default value is NO.
The following effects can be achieved by matching:
① When chroot_list_enable=YES, chroot_local_user=YES, users listed in the /etc/vsftpd.chroot_list file can switch to other directories; users not listed in the file cannot Change to another directory.
②When chroot_list_enable=YES and chroot_local_user=NO, users listed in the /etc/vsftpd.chroot_list file cannot switch to other directories; users not listed in the file can switch to other directories.
③ When chroot_list_enable=NO and chroot_local_user=YES, all users cannot switch to other directories.
④When chroot_list_enable=NO, chroot_local_user=NO, all users can switch to other directories.

Guess you like

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