Redhat Linux vsftpd compile and install

  

Log in as root account RedHat bashshell


[root@redhat ~]# tar -zxvf vsftpd-2.0.5.tar.gz //Unzip vsftp source file


[root@redhat ~]# cd vsftpd-2.0.5 //Enter the unzipped directory

[root@redhat vsftpd-2.0.5]# more INSTALL //Take a look at the installation instructions. For example, what work to do. Is an English document.

[root@redhat vsftpd-2.0.5]# useradd nobody //This requires a nobody user. You can use the finger nobody to view it. See if there is this user. Need to add

[root@redhat vsftpd-2.0.5]# mkdir /usr/share/empty //This step is the same as above. The server needs an empty empty directory under /usr/share/. Can be viewed using ls /usr/share/empty. If it exists, it is not needed. This step can also be skipped


If you need to enable anonymous user access, you need to do the following steps

[root@redhat vsftpd-2.0.5]# mkdir /var/ftp //Create a directory for anonymous users

[root@redhat vsftpd-2.0.5]# useradd -d /var/ftp ftp //Create an ftp user and specify the home directory as /var/ftp, This step is also available in general systems. If you create a prompt: user ftp exists, this user already exists.


Continue to the next step

[root@redhat vsftpd-2.0.5]# chown root.root /var/ftp //Set /var/ftp, which is the ftp user The home directory group and owner are root, for security. This step is still needed

[root@redhat vsftpd-2.0.5]# chmod og-w /var/ftp //Change the permissions, remove the write permission of the group and others


The above writing work is done. The following can be cheaper

[root@redhat vsftpd-2.0.5]# make //compile the binary file

[root@redhat vsftpd-2.0.5]# make install //install , you can see the relevant files installed during the installation.

[root@redhat vsftpd-2.0.5]# cp vsftpd.conf /etc///Copy configuration file

[root@redhat vsftpd-2.0.5]# cp RedHat/vsftpd .pam /etc/pam.d/ftp //Copy PAM security verification file This is the directory where the verification file is located


[root@redhat vsftpd-2.0.5]# vi /etc/vsftpd. Conf

Then press to jump to the end of the line. Set pam_server_name=ftp (to have the same name as your PAM file); userlist_enable=YES (users of the user list are not allowed to log in to the server). Then: wq save and exit


[root@redhat vsftpd-2.0.5]# cp vsftpd.conf.5 /usr/local/man/man5

[root@redhat vsftpd -2.0.5]# cp vsftpd.8 /usr/local/man/man8


Basically here. All the work is done. But there is something to say


By default, vsftp runs as a super daemon (xinetd).


Startup mode (two ways)

[root@redhat vsftpd-2.0.5]# service xinetd restart //Restarting the super daemon is equivalent to starting vsftp


Another way is to modify the configuration file independently.

[root@redhat vsftpd-2.0.5]# vi /etc/vsftpd.conf


Then press to jump to the end of the line. Add listen=YES. Then: wq save and exit


so you can use the following statement to start

[root@redhat vsftpd-2.0.5]# /usr/local/sbin/vsftpd & //Start the vsftp

[root@redhat vsftpd-2.0.5]# echo "/usr/local/sbin/vsftpd &" >> /etc/rc.local //append to start The above two methods can be used freely on the script


. I also did some experiments on the startup script (started by service vsftpd start) and it ended up failing. But I want to say. I am working hard. Because I am not very familiar with shell programming. Failed to write a script that was used, hehe. learn! There may still be a solution. Install a vsftp using RPM and see how the script in init.d is written.


Paste someone else's article about configuration


#Anonymous user

anonymous_enable=NO

#anon_mkdir_write_enable=YES < Br>

#anon_upload_enable=YES

#Can local users log in?

#local_enable=YES

#Can write?

write_enable=YES

#VSFTPD runs independently (with vsftpd /etc/vsftpd.conf &) and download speed limit

listen=YES

max_clients=600

max_per_ip=5

tcp_wrappers=YES

connect_from_port_20=YES

#anon_max_rate=51200 (56k)

#local_max_rate=512000 (560k)

#How to change the path

#anon_root=/var/ftp/pub

#local_root=/var/ftp

#How to add a user directory at will< Br>

can be achieved by useradd -d /path/dir -M name and chmod ? /path/dir

#How to use disk quota

to use quota to /etc/fstab Restrictions, then restrict specific users


Supplement:


Supplement 1: How to restrict users to the home directory?


We have to build a file ourselves, in the /etc directory


#touch /etc/vsftpd.chroot_list


to beinan this User as an example


In the vsftpd.chroot_list file, add beinan on it.


Then change the /etc/vsftpd/vsftpd.conf file and find the following two lines


#chroot_list_enable=YES


#chroot_list_file =/etc/vsftpd.chroot_list


Remove the previous ##, which is like this


chroot_list_enable=YES


chroot_list_file= /etc/vsftpd.chroot_list


If there are no such two lines, you can add them yourself.


After setting up, re-vsFTPD server.


Supplement 2: Open the log function of the vsFTP server:


Take off the ## in front of the xferlog_file, that is, open the log function of vsftp, so that we can You can view vsftpd.log in the /var/log directory. This is the logging function of vsFTP, which is extremely important for us.


#xferlog_file=/var/log/vsftpd.log


Supplement 3: How to make IP binding to vsFTP? In other words, how to allow users to access FTP through only one IP. In fact, this feature is very interesting. If the IP of the intranet is bound, there is no way to access it outside. If the IP address is bound to the external service, the intranet can only access the FTP through the IP of the external service.


Add a line in /etc/vsftpd/vsftpd.conf to my LAN. For example, please see the operating environment in the first post, so the external network can not access my FTP, the intranet may also access FTP through 192.168.0.2


listen_address=192.168.0.2


After the addition, restart the vsFTP server.

Copyright © Windows knowledge All Rights Reserved