Today, a company partner said that he wants to upload files to us. I don't need to open an FTP for a text file, but I can only open one. I have never done it before, search for FTP in Linux on the network, and you can use vsftp or software to create one. I heard that vsftp is also quite good, so I will follow the network tutorial step by step, here, I will summarize my practices. After all, not everyone will go to some detailed articles when they are in urgent need of use.
1. Use these commands to check if vsftpd is correctly installed.
# Service vsftpd start
# Service vsftpd stop
# Service vsftpd restart
2. If there is no problem, edit the vsftpd configuration file.
[Root @ localhost/] # vi/etc/vsftpd. conf // the specific content of this file can be seen in the first link of the "reference article" below
3. Change anonymous_enable = yes to no # prohibit Anonymous Access
4. Find chroot_list_file =/etc/vsftpd. chroot_list in vsftpd. conf, remove the comments, and create
In the/etc/vsftpd. chroot_list file, enter one or more user names (one row) in the Linux system ).
Note: This user name is added by the root user in Linux.
[Root @ localhost/] # useradd-S/sbin/nologin // restrict users from logging on Using SSH
5. Changing the ftp port is still in the vsftpd. conf file:
Tcp_wrappers = Yes
Listen_port = 2121 // custom port number. Do not conflict with an existing port.
Local_root =/Server/Apache/htdocs // set the directory displayed when user explorer connects to FTP
Save and exit editing.
6.
# Service vsftpd restart. Then an FTP instance is activated using the existing user name in the system,
Note: The # service vsftpd start command only enables the vsftpd command manually after Linux is enabled. If Linux is restarted, use this command to restart.
To start the vsftp service at startup: Run chkconfig -- level 35 vsftpd on (the network query has not been practiced)
Postscript:
If you have time to study and look at the part of virtual users, virtual users may be safer and more complex than system users.
Reference virtual User Creation:
========================================================== ==================
[Root @ server root] # useradd vuser # create a specified virtual Login Number!
[Root @ server root] # vi users.txt # virtual account template-one line of user name and the next line of password
[Root @ server root] # db_load-T-t hash-F users.txt/etc/vsftpd. login. DB contents are added to users.txt as the account and password of the virtual user.
[Root @ server root] # chmod 600/etc/vsftpd. login. DB # modify the content to ensure security
[Root @ server root] # vi/etc/PAM. d/FTP # modify the content to make it the same as the following
[Root @ server root] # More/etc/PAM. d/ftp
# % PAM-1.0
# Auth required/lib/security/pam_listfile.so item = user sense = allow file
=/Etc/ftpusers onerr = succeed
# Auth required/lib/security/pam_pwdb.so shadow nullok
# Auth required/lib/security/pam_shells.so
# Account required/lib/security/pam_pwdb.so
# Session required/lib/security/pam_pwdb.so
Auth required pam_userdb.so DB =/etc/vsftpd. Login
Account required pam_userdb.so DB =/etc/vsftpd. Login
Modify/etc/vsftpd again. conf to disable all content related to anonymous, and the chroot is also listed as disabled. If you want to use it, make sure that the virtual number can be used normally before testing, add the following sentence at the end:
Guest_enable = Yes
Guest_username = vuser: restart vsftpd.
[Root @ server root] # killall-hup vsftpd #!
[Root @ server root] # ftp localhost # Test
Connected to server.redhat.org.cn.
220 welcome to linfeng's FTP server.
530 please login with user and pass.
530 please login with user and pass.
Kerberos_v4 rejected as an authentication type
Name (localhost: Root): Tom # virtual number
331 please specify the password.
Password: # password of the virtual account Tom
230 login successful. # successful
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp> ls
227 entering passive mode (, 0)
150 here comes the directory listing.
226 transfer done (but failed to open directory). # How can this problem be disabled? Think about the above, huh, huh, this is because of vuser permissions, you only need to "chmod o + R/home/vuser" to browse, but not upload, because there is no "W" bit
============================================
Network references:
Http://www.bianceng.cn/ OS /Linux/200706/3020.htm
Http://www.shineblog.com/user2/24790/archives/2005/175940.shtml
Both are detailed.