Summary of vsftp installation in linux-Linux Enterprise Application-Linux server application information. The following is a detailed description. Download the secret from the official vsftp website
The configuration of anonymous users will not be written here. In the following configuration, anonymous users will be included in the package, and anonymous users will not be used, my software is downloaded to the root directory. Then we copy the file to use/local and then use:
# Tar xzvf vsftpd-2.0.3.tar.gz // extract Program
# Cd vsftpd-2.0.3 \ enter this file
# Nano builddefs. h \ edit the builddefs. h file. The file content is as follows:
# Ifndef VSF_BUILDDEFS_H
# Define VSF_BUILDDEFS_H
# Undef VSF_BUILD_TCPWRAPPERS
# Define VSF_BUILD_PAM
# Undef VSF_BUILD_SSL
# Endif/* VSF_BUILDDEFS_H */
Change # undef VSF_BUILD_TCPWRAPPERS to # define VSF_BUILD_TCPWRAPPERS
Then # make install
Then cp vsftpd. conf/etc and cp RedHat/vsftpd. pam/etc/pam. d/ftp
Create necessary accounts and directories:
# Useradd nobody // your system may already have this account, so you do not need to create
# Mkdir/usr/share/empty // This directory may already exist in your system, so you do not need to create
Key points must be set up # mkdir/var/ftp // This directory may already exist in your system, so you do not need to set up
Key # useradd-d/var/ftp // This account may already exist in your system, so you do not need to create
Key # chown root: root/var/ftp
# Chmod og-w/var/ftp
Remember, if you do not want a user to log on locally, you need to set the login SHELL to/sbin/nologin, for example, the above nobody and ftp are set to/sbin/nologin.
Edit etc/vsftpd. conf now
Disable Anonymous user login and add # To # anonymous_enable = YES before anonymous_enable = YES
Allow local users to log on and change # local_enable = YES to local_enable = YES.
Allow local users to upload and change # Before write_enable = YES # To write_enable = YES
If you do not want to execute the uploaded file, replace # Before # local_umask = 022 with local_umask = 022.
At the same time, add listen = YES at the bottom to enable the server to automatically listen and change the port. Add listen_port = port number at the end.
Use/usr/local/sbin/vsftpd & to start the server and test the ftp localhost port number (if it is the default port, no port number is needed ).
Security Options
Idle_session_timeout = 600 (seconds) (10 minutes after the user's session is idle)
Data_connection_timeout = 120 (seconds) (idle 2 minutes)
Accept_timeout = 60 (seconds) (disconnect the client one minute later)
Connect_timeout = 60 (seconds) (disconnect again after 1 minute)
Local_max_rate = 50000 (bite) (Local User transfer rate: 50 K)
Anon_max_rate = 30000 (bite) (anonymous user transfer rate: 30 K)
Pasv_min_port = 50000 (change the client's data connection port
Pasv_max_port = 60000 between and)
Max_clients = 200 (maximum number of FTP connections)
Max_per_ip = 4 (maximum number of connections per IP)
Listen_port = 5555 (data connection from port 5555)
Check who logged on to FTP and killed the FTP process.
Ps? Xf | grep ftp
Kill process number
We started to create a specified FTP user.
Configure the FTP
First, create the main directory of the user group test and FTP
Groupadd test
Mkdir/tmp/test
Then create a user
Useradd-G test? D/tmp/test? M usr1
Note: G: the user's Group d: indicates that the location of the user's own directory is specified.
M: do not create a default home directory, that is, there is no home directory.
Useradd? G test? D/tmp/test? M usr2
Then, change the owner and permissions of the folder.
Chown usr1.test/tmp/test ---- This indicates that the owner of/tmp/test is set to usr1
Chmod 750/tmp/test ---- 7 indicates wrx 5 indicates rx 0 indicates no Permissions
Set the password passwd usr1 for usr1 and enter the password twice.
Test ftp localhost 33333 to log on with usr1 and password, and then use put/etc/services to upload files.
Use ls to view uploaded files.
The purpose of this experiment is that usr1 has the upload, deletion, and download permissions.
However, usr2 only has the download permission and does not have the upload and deletion permissions.
Of course, don't forget our main configuration file vsftpd. conf.
Make sure that the local_enable = yes, write_enable = yes, And chroot_local_usr = yes options are available!
Configure non-port standard mode for independent FTP servers for Data Connection
This is very easy: In VSFTPD. Add Listen_port = 33333 in CONF
That's it! It should be emphasized that after the port is changed, FTP login must cancel the passive mode or login fails.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service