Vsftpd Server Configuration

Source: Internet
Author: User
Vsftpd server configuration-Linux Enterprise Application-Linux server application information. The following is a detailed description. 1. Backup configuration file/etc/vsftpd. conf
[Root @ localhost root] # cd/etc/vsftpd/
[Root @ localhost vsftpd] # ls
Vsftpd. conf
[Root @ localhost vsftpd] # cp vsftpd. conf vsftpd. conf. BAK
[Root @ localhost vsftpd] # ls
Vsftpd. conf vsftpd. conf. BAK


2. Configure the vsftpd Server
[Root @ localhost vsftpd] # gedit vsftpd. conf &
[1] 4872

Delete all content in vsftpd. conf and write the following content:

#/////////////////////////////////////// ////////////
# Allow Anonymous Access and have the upload and download permissions.
Anonymous_enable = YES
Write_enable = YES
Anon_upload_enable = YES
Anon_mkdir_write_enable = YES
Anon_world_readable_only = NO

# Display logon information. The login information is in the ". message" file under the ftp shared directory.
Dirmessage_enable = YES

# Use port 20 (ftp-data) for data connection
Connect_from_port_20 = YES

Userlist_enable = YES

# Start in independent mode,
Listen = YES
#/////////////////////////////////////// ////////////





3. Restart the vsftpd service.

[Root @ localhost vsftpd] # service vsftpd restart
Disable vsftpd: [failed]
Start vsftpd For vsftpd: [OK]
[1] + Done gedit vsftpd. conf
[Root @ localhost vsftpd] # pgrep vsftpd
4982
[Root @ localhost vsftpd] #
Check whether vsftpd is working properly. If there is a number as shown above, it indicates that it has been started,
If there is no response, it is not started, for example:
[Root @ localhost vsftpd] # pgrep vsftpd
[Root @ localhost vsftpd] #


4. Test the vsftpd Server

(1) method 1
Check whether the IP address of your computer is configured.
[Root @ localhost vsftpd] # ifconfig
Eth0 Link encap: Ethernet HWaddr 00: 11: 5B: C4: AE: A5
Inet addr: 192.168.0.56 Bcast: 192.168.0.255 Mask: 255.255.255.0
Up broadcast running multicast mtu: 1500 Metric: 1
RX packets: 1952 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 378 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 FIG: 100
RX bytes: 486797 (475.3 Kb) TX bytes: 53334 (52.0 Kb)
Interrupt: 11 Base address: 0xe800

Lo Link encap: Local Loopback
Inet addr: 127.0.0.1 Mask: 255.0.0.0
Up loopback running mtu: 16436 Metric: 1
RX packets: 17721 errors: 0 dropped: 0 overruns: 0 frame: 0
TX packets: 17721 errors: 0 dropped: 0 overruns: 0 carrier: 0
Collisions: 0 txqueuelen: 0
RX bytes: 1211137 (1.1 Mb) TX bytes: 1211137 (1.1 Mb)

The IP address 192.168.0.56 is shown below:
Inet addr: 192.168.0.56 Bcast: 192.168.0.255 Mask: 255.255.255.0
[Root @ zieckey vsftpd] # ftp 192.168.0.29
Connected to 192.168.0.29.
220 (vsFTPd 1.1.3)
530 Please login with USER and PASS.
530 Please login with USER and PASS.
KERBEROS_V4 rejected as an authentication type
Name (192.168.0.29: root): ftp
331 Please specify the password.
Password:
230 Login successful. Have fun.
Remote system type is UNIX.
Using binary mode to transfer files.
Ftp> ls
227 Entering Passive Mode (192,168, 209,131)
150 Here comes the directory listing.
Drwxrwxrwx 2 0 0 4096 Nov 03 12:27 incoming
Drwxr-xr-x 2 0 0 4096 Nov 03 12:06 pub
226 Directory send OK.
Ftp>! Ls Note: add it before the command! Is to operate on the local directory
Vsftpd. conf vsftpd. conf ~ Vsftpd. conf. BAK vsftpd. conf. BAK1 vsftpdserver creates step .txt
Ftp>





(2) method 2
[Root @ localhost vsftpd] # gftp &
[1] 4892
[Root @ localhost vsftpd] #


Note that the created vsftpd server has the upload and download permissions,
But now we can find that we cannot upload any files. Why?

For security considerations, vsFTPd does not allow ftp users to have no permission on their home directories,
You can read the vsFTPd document to understand it. Otherwise, it cannot be called the safest FTP server, right?
It is also easy to do this. Create a directory under/var/ftp and the permission is 777.

For example:
[Root @ zieckey ~] # Cd/var/ftp/
[Root @ zieckey ftp] # mkdir incoming
[Root @ zieckey ftp] # chmod 777 incoming/




5. Change the ftp shared directory

[Root @ zieckey ftp] # cd/etc/
[Root @ zieckey etc] # cp passwd. BAK
[Root @ zieckey etc] # gedit passwd &
Find the ftp line:
Ftp: x: 14: 50: FTP User:/var/ftp:/sbin/nologin
/Var/ftp is the root directory of ftp.
Change the ftp root directory.

6. temporarily put the directory you want to share to the ftp root directory

This can be achieved through virtual paths.

For example:
/Home/a ing is ftp: // localhost/
/Home/B/c is set to ftp: // localhost/c

In fact, this cannot be said to be the content of vsFTPd. In fact, we have been using it for a long time. We may not have noticed it. We can implement it through the following methods.
[Root @ localhost ~] # Mount -- bind [original directory] [new directory]

For example, we want to share the/home directory with remote users through ftp.
We can do this:

Create a directory in the/var/ftp directory first.
[Root @ zieckey etc] # mkdir/var/ftp/home
[Root @ zieckey etc] # mount -- bind/home // var/ftp/home/
In this way, pull.
Now, you can check:
[Root @ zieckey ftp] # ls/var/ftp/home/
Download (2) work zieckey

You can see the/home directory in the/var/ftp/home directory.

What if I don't want to share/home? Use umount to pull
[Root @ zieckey ftp] # umount/var/ftp/home/
[Root @ zieckey ftp] # ls/var/ftp/home/
[Root @ zieckey ftp] #
Related Article

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.