A Brief Introduction to the Installation and Configuration of vsftp under CentOS - Linux|Unix - Operating System - Eden Network

by henxue on 2010-07-14 21:47:37

The usage of CentOS vsftpd is still quite common, so I took some time to study the methods of using CentOS vsftpd. Here, I'd like to share it with everyone and hope it will be useful for you. This article provides a brief introduction to the use of CentOS vsftpd under CentOS.

**CentOS vsftpd Installation:** There's no need to explain how to install or start the service, but the key lies in the configuration after starting the CentOS vsftpd service:

**My Environment:** CentOS 5.3 GNOME vsftpd

1. **Installation:** `yum install vsftpd`

2. **Start Service:** `service vsftpd start`

3. **Create FTP User:**

1. **Creating a User for CentOS vsftpd:** Go to "System | Administration | Users and Groups | Users," and click "Add User." For example, create a user named `ftp` with the password `ftpadmin`. Set the login shell to `/sbin/nologin`. Below that, check the options "Create home directory," "Create private group for this user," and "Manually specify user ID."

2. **Modify User Attributes:** Double-click on the user. In the "Home Directory" field, enter `/mnt/winc/ftproot` (this is the directory for your FTP). Select the group as `ftp`, then confirm. Note: The default home directory is `/home/ftp`, but it's recommended to change it to the actual path of your FTP directory, such as `/mnt/winc/ftproot` because all your FTP files are stored there. For the login shell, select `/sbin/nologin`. This ensures the user cannot log into the system directly but can still use FTP.

3. **Modify SELinux Parameters:**

```bash

setsebool ftpd_disable_trans 1

service vsftpd restart

```

Explanation: If you don't modify these settings, you might encounter the following error when connecting:

```

500 OOPS: cannot change directory:/mnt/winc/ftproot*******

500 OOPS: child died

```

After completing the entire process of creating the user, a new line will be added to the `/etc/passwd` file:

```

ftpadmin:x:501:50:ftpadmin:/mnt/winc/ftproot:/sbin/nologin

```

With these steps, CentOS vsftpd should now work properly...

---

**Original Article Source:** 【Eden Network】http://www.edenw.com/tech/os/unix/2010-07-14/4682.html