How to install and configure vsftpd
2012-12-25 21:19
411 查看
This tutorial focuses on how to setup vsftpd server on your linux based VPS or a dedicated server. The vsftpd stands for “Very Secure FTP Daemon”. It is not just secure as the name suggests but also delivers excellent performance by consuming less memory. The tutorial also teaches you how to configure by adding ftp users and locking the directory to individual users.
You can install vsftpd on Ubuntu / Debian, CentOS /Fedora and RHEL linux.
Installing vsftpd on Ubuntu or Debian
Installing vsftpd on CentOS / Fedora
How to configure vsftpd:
Now that you’ve installed vsftpd, follow this procedure to configure it. These steps applies for both the linux variants.
Before you get started, stop the vsftpd by typing:
Edit the vsftp.conf
In Ubuntu / Debian:
In Red Hat / CentOS
Make the following changes:
We don’t want anonymous login:
anonymous_enable=NO
Enable local users:
local_enable=YES
The ftpuser should be able to write data:
write_enable=YES
Port 20 need to turned off, makes vsftpd run less privileged:
connect_from_port_20=NO
Chroot everyone:
chroot_local_user=YES
set umask to 022 to make sure that all the files (644) and folders (755) you upload get the proper permissions.
local_umask=022
Now that basic configuration is complete, now let us begin with locking / securing a directory to user.
Setup a password for the user:
In order to enable the ftpuser read and write the data in your home dir, change the permission and take ownership:
Create userlist file and add the user:
Ubuntu / Debian:
CentOS / Fedora
and add the user:
save the file and open the vsftp.conf file again:
Add the following lines at the end of the file and save it:
# the list of users to give access
userlist_file=/etc/vsftpd.userlist
# this list is on
userlist_enable=YES
# It is not a list of users to deny ftp access
userlist_deny=NO
After completing all these procedures it is almost ready to use it, give it a try but you will get a 500 OOPS permission denied error. To fix it you need to add a nologin to the shell set.
The file should look like this:
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
Add this line at the end:
Now create a usergroup and add the ftpuser to it:
Now start the vsftpd:
That’s it. Now you have a secure installation of vsftpd on your server.
You can install vsftpd on Ubuntu / Debian, CentOS /Fedora and RHEL linux.
Installing vsftpd on Ubuntu or Debian
sudo apt-get install vsftpd
Installing vsftpd on CentOS / Fedora
yum install vsftpd
How to configure vsftpd:
Now that you’ve installed vsftpd, follow this procedure to configure it. These steps applies for both the linux variants.
Before you get started, stop the vsftpd by typing:
service vsftpd stop
Edit the vsftp.conf
In Ubuntu / Debian:
vi /etc/vsftpd.conf
In Red Hat / CentOS
vi /etc/vsftpd/vsftpd.conf
Make the following changes:
We don’t want anonymous login:
anonymous_enable=NO
Enable local users:
local_enable=YES
The ftpuser should be able to write data:
write_enable=YES
Port 20 need to turned off, makes vsftpd run less privileged:
connect_from_port_20=NO
Chroot everyone:
chroot_local_user=YES
set umask to 022 to make sure that all the files (644) and folders (755) you upload get the proper permissions.
local_umask=022
Now that basic configuration is complete, now let us begin with locking / securing a directory to user.
sudo useradd -d /var/www/path/to/your/dir -s /usr/sbin/nologin ftpuser
Setup a password for the user:
sudo passwd ftpuser
In order to enable the ftpuser read and write the data in your home dir, change the permission and take ownership:
sudo chown -R ftpuser /var/www/path/to/your/dir
sudo chmod 775 /var/www/path/to/your/dir
Create userlist file and add the user:
Ubuntu / Debian:
vi /etc/vsftpd.userlist
CentOS / Fedora
vi /etc/vsftpd/vsftpd.userlist
and add the user:
ftpuser
save the file and open the vsftp.conf file again:
vi /etc/vsftpd.conf
Add the following lines at the end of the file and save it:
# the list of users to give access
userlist_file=/etc/vsftpd.userlist
# this list is on
userlist_enable=YES
# It is not a list of users to deny ftp access
userlist_deny=NO
After completing all these procedures it is almost ready to use it, give it a try but you will get a 500 OOPS permission denied error. To fix it you need to add a nologin to the shell set.
vi /etc/shells
The file should look like this:
/bin/ksh
/usr/bin/rc
/usr/bin/tcsh
/bin/tcsh
/usr/bin/esh
/bin/dash
/bin/bash
/bin/rbash
Add this line at the end:
/usr/sbin/nologin
Now create a usergroup and add the ftpuser to it:
sudo addgroup ftpusers
sudo usermod -Gftpusers ftpuser
Now start the vsftpd:
service vsftpd start
That’s it. Now you have a secure installation of vsftpd on your server.
相关文章推荐
- How to install and configure vsftpd
- How to install and configure Azure PowerShell
- How to install and configure Apache, PHP, MySql and phpMyadmin on ubuntu
- How to install and configure Apache, PHP, MySql and phpMyadmin on ubuntu
- How to Install And Configure Apache In Ubuntu
- MinGW - 安装和配置 / MinGW - Howto Install And Configure
- How to Install and Configure Nginx from Source on centos--转
- how to install and configure Remote BLOB Storage (RBS) in a SharePoint 2013 farm
- How to Configure and Install ownCloud on Ubuntu 16.04
- 在64位系统下安装32位ODBC驱动问题How to install and configure a 32 bit ODBC driver on a 64 bit Operating System?
- How to install and configure Jabber Server (Ejabberd) on Debian Lenny GNU / Linux
- How to Configure, Install and Use libnefilter_queue on Linux
- How To Install And Configure Ganglia On Red Hat Enterprise Linux 5---YUM 安装篇
- How to Configure, Install and Use libnefilter_queue on Linux
- Howto Install and Configure Chinese Input Methods on Ubuntu
- How To Install and Configure Django with Postgres, Nginx, and Gunicorn
- Howto Install and Configure Doxygen for QtCreator on Ubuntu
- How to install and configure NGINX on CentOS 7
- Howto Install and Configure VTK on Ubuntu