How to Build FTP using vsftpd in Ubuntu 12.04

Source: Internet
Author: User
Tags ftp login
For more information, see

Http://book.51cto.com/art/200810/92757.htmis a book. I think I have to finish reading this book if I have time.

Http:// OS .51cto.com/art/201008/222036.htmtopic, extended reading

Web Information

The vsftpd homepage is vsftpd.beasts.org.

Howto

FTP mini-howto

Anonymous vsftpd Logon

Anonymous logon is rarely mentioned on the network. It may be insecure, but sometimes it is necessary to Configure ftp.

The key is to add this command anon_root =/var/run/vsftpd/empty which can be customized. Some system default paths are/var/FTP.

This empty folder has 755 permissions (permissions cannot be obtained), and then a new folder user (the name can be customized) is created in it. The permission is 777, you can operate under this user

Easy-to-use configuration

Introduction: This command can be used to create a separate directory for each user, or to set other permissions and functions.

User_config_dir

Specify a directory that contains files named by the user name of the local user. Each such file (similar to vsftpd. conf) contains parameters that overwrite the default parameters (based on each user) and the parameters specified in vsftpd. conf. For example, set user_config_dir to/etc/vsftpd/user_conf. If the default configuration file (/etc/vsftpd. conf) sets idlesession_timeout = 300, while the Sam's personal configuration file (/etc/vsftpd/user_conf/SAM) sets idlesession_timeout = 1200. In addition to Sam, no active Session Timeout of all users is 300 seconds, while the Session Timeout of Sam is 1.
200 seconds.

Default Value: None

Http://book.51cto.com/art/200810/92809.htm

We can use this method to specify different root directories for different users. This is not an experiment yet. By default, all login users use the same root directory.

Notes

Listen

If set to yes, vsftpd runs in standalone mode. If set to no, vsftpd runs in normal mode.

If you do not understand it, select Yes. This is to start vsftpd directly. If you select No by default, vsftpd runs on demand through the xinet daemon. Other settings are required, I did it again, but it was unsuccessful.

If you don't have time to learn vsftpd and configure it quickly, read this

I have a lot of experience on the network, but I have been talking about how to configure Anonymous logon. However, the configuration is not successful, so I changed to username logon. Refer to the basic tutorial.

Http://wiki.ubuntu.org.cn/Vsftpd%E5% AE %9E%E4%BE%8B

Http://wiki.ubuntu.org.cn/Vsftpd

Supplement:

User name logon refers to a Linux system to a user. At first, I thought it was ftp's own account Retained. This is wrong. Because of this, you need to create an ftpuser account and an FTP group in Linux, and create the/home/ftpuser root directory, the above tutorial will link/var/FTP/to this root directory. After you log on to ftpuser, the root directory will see/var/FTP.

The ftpuser permission configuration is as follows:

Gitserver:/home $ LL
Total 28
Drwxr-XR-x 5 root Root 4096 Jul 9 17: 55 ./
Drwxr-XR-x 24 Root 4096 Jul 9 :04 ../
Drwxr-XR-x 3 Root 4096 Jul 4 00:51. ecryptfs/
Drwx ------ 2 ftpuser FTP 4096 Jul 9 ftpuser/
Drwx ------ 32 Norton 12288 Jul 9 Norton/

Gitserver:/var/FTP $ LL
Total 16
Drwxr-XR-x 3 Root 4096 Jul 9 :32 ./
Drwxr-XR-x 15 Root 4096 Jul 9 16: 54 ../
-RW-r -- 1 Root 31 Jul 9 :32. Message
Drwxrwxr-x 3 root ftp 4096 Jul 9 18:10 pub/

Command Used: refer to the following common commands

Common commands

Check whether port 21 is enabled

$ sudo netstat -npltu | grep 21tcp        0      0 0.0.0.0:21              0.0.0.0:*               LISTEN      15601/vsftpd    

Useradd

Passwd

Chown change file owner

Chmod

Touch

Rm

MV

Mkdir

The location where the file is located, for example, locate nologin. For more information, see man locate.

Updatedb if the locate file is not installed, sudo updatedb updates the database.

Security Configuration

Note: The account used for FTP login is a system account, but the password is in plain text during transmission, so it is not safe. You must restrict the shell of the network account and use nologin, you cannot use this account to log on to the system. It is not so dangerous to lose an account.

Enable/etc/passwd with sudo permission

Change the shell of the network account to nologin. Go to/usr/sbin/nologin.

If you do not know, you can enter locate nologin to view the location

Summary of Common Errors

1.500 Oops: vsftpd: refusing to run with writable root inside chroot ()
Login Failed.
The document permission should be set to not writable.

2. After following the tutorial and then trying to use filezilla to copy a file to the home/username/Files directory, I was getting this error: open for write:

Permission denied
Error: File Transfer failed

I got this working by executing: chown username home/username/Files

After executing that I was able to copy a test file to the Files folder.

3. Path Problems
To see what permissions you have already set for any directory

Sudo LS-La/var/www/

Replace "/var/www/" with the directory you need to check!

3. Dark @ dark-LAPTOP :~ $ FTP 14.14.14
FTP: CONNECT: Connection refused
Vsftpd. conf is incorrect. Check whether the spelling is correct.

4. Name (14.14.14.14: Dark): customer
331 please specify the password.
Password:
500 Oops: Missing Value in config file for:/home/ftpuser/
Login Failed.
421 service not available, remote server has closed connection

This is because I only wrote the address.
Vsftp. conf file configuration error.
Note that no leading space is required. No leading space is required before or after the = sign.
= There must be content later.
Otherwise, comment out.

5. Name (14.14.14.14: Dark): customer
331 please specify the password.
Password:
500 Oops: cannot change Directory:/home/ftpuser/
Login Failed.

This path does not exist.

6. 331 please specify the password.
Password:
530 login incorrect.
Login Failed.

Incorrect password. Check whether the password configuration file is correct.

Advanced Configuration

Learn how to configure xinet. This is a super daemon that provides high security and helps you manage various network services and even system services.

Http://wordpress.facesoho.com/server/what-is-xinetd.html

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.