Centos settings vsftp

  

vsftpd (Very Secure FTPd Daemon) is a commonly used FTP server software under LINUX. Below I will briefly introduce the installation and configuration process.

First check if vsftpd is installed

# rpm -qa |
  Grep vsftpd

If it is already installed, its version number will be displayed. If there is no display after executing the command, the system is not installed.

Installation

The online installation method with YUM is the easiest:

# yum install vsftpd -y

After executing the command, it starts to download and install automatically, and finally displays Complete means that the installation is OK.

Open port 21 in Linux (this is the default port used by FTP, you can also use your own port number, of course, if the configuration file of vsftpd needs to be modified accordingly, I will only introduce the default. 21 port)

# vi /etc/sysconfig/iptables

Open the system configuration file and add a configuration code to open port 21:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 21 - j ACCEPT

Then save the changes. Restart the firewall to make the configuration take effect.

# service iptables restart

Starting the vsftpd service

# service vsftpd start

If successful, it will show Starting vsftpd for vsftpd: [OK]

# chkconfig Vsftpd on # netstate -tunlp |
  Grep vsftpd

Output tcp 0 0 0.0.0.0:21 means the service is running normally

Turn off anonymous login

Now you open the browser directly and type fpt://your server IP, you can open the default FTP directory. The default FTP directory path for vsftpd is /var/ftp/pub

Of course, we generally don't want FTP to log in anonymously. Modify the vsftpd configuration file to disable anonymous login.

Open the vsftp configuration file

# vi /etc/vsftpd/vsftpd.conf

Set the :anonymous_enable to NO, note that if the sentence starts with a #annotation, you need delete.

# Allow anonymous FTP? (Beware - allowed by default if you comment this out).#anonymous_enable=YESanonymous_enable=NO

After modifying and saving the configuration file, restart the vsftpd service

 # service vsftpd restart

Adding an FTP User

OK, since the anonymous service is turned off, which user is used to log in? At this time, you need to create a new user for vsftpd, which is the user you use when logging in to FTP.

# useradd -d /var/ftp/pub -s/sbin/nologin FTPuserName

Set the login password for this user:

# passwd FTPuserName

Now you can use this A user called FTPuserName logs in to FTP.

Modifying the read and write permissions of the FTP folder

Then you may also find out why you can't create or delete folders\\files because the /var/ftp/pub directory does not have permission to operate. This directory can be set to delete permissions.

# chmod 777 /var/ftp/pub

ftp default we use system users, now we add user ftptest, point to the directory /home/ftptest, the permission is nologin, that is, no shell permissions, no

# useradd ftptest -d /home/ftptest -s /sbogin

If ftp is displayed: in/nol

useradd: warning: the home directory already exists. Not copying any File from skel directory into it.

Don't bother, just tell you that the directory you pointed to already exists, this does not affect the set of directories and their files, you can also use other grouping methods

# chown -R ftptest . ftptest /home/ftptest

Set the password for the user hao32, customize it

# passwd ftptest

Add the user ftptest to /etc/vsftpd/In vsftpd.chroot_list, the user can log in normally and cannot jump out of his directory

# echo ‘ ftptest ′ >> /etc/vsftpd/vsftpd.chroot_list# service vsftpd restart
						
Copyright © Windows knowledge All Rights Reserved