Setup VSFTPD Server with Virtual Users On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3
We have already shown you How to Setup VSFTPD Server on CentOS 6.5/6.4 in our previous article. In that method, the users created in the server itself were logged-in to FTP server (i.e. local users). But what if the users who don’t have a local account in FTP server?
Well, in this article we let us setup vsftpd server with virtual users. ie. the users who don’t have local account in the FTP server itself can login to FTP server.
I assume that you already have installed and configured FTP server. If didn’t, visit to the above mentioned link to setup FTP server.
Install Berkeley Database(db4)
In this method, we use Berkeley database(db4(version4) to store virtual user names with their passwords. First install db4-utils package if it not installed:
# yum install db4-utils db4 -y
Create database file for virtual users
First create a plain text file and enter the virtual user names and their passwords one by one. Then create the db file from the plain text file.
For instance, i create a plain text file called virtual_users.txt in /home directory with username senthil and password centos:
# vi /home/virtual_users.txt
Add username and password one by one.
senthil
centos
Save and exit the file. Run the following command to create database file:
# db_load -T -t hash -f /home/virtual_users.txt /etc/vsftpd/virtual_users.db
Here virtual.db is the actual database file for virtual users.
Create a PAM file
Now create a PAM file to use the database virtual_users.db which we created from the plain text file. Create a file/etc/pam.d/vsftpd_virtual,
# vi /etc/pam.d/vsftpd_virtual
Add the following lines:
#%PAM-1.0
auth required pam_userdb.so db=/etc/vsftpd/virtual_users
account required pam_userdb.so db=/etc/vsftpd/virtual_users
session required pam_loginuid.so
Save and exit the file.
vsftpd configuration
Edit file /etc/vsftpd/vsftpd.conf,
# vi /etc/vsftpd/vsftpd.conf
Make sure that you have added or edited the following lines as shown below:
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=NO # Uncomment this to allow local users to log in.
local_enable=YES ## Enable virtual users
guest_enable=YES ## Virtual users will use the same permissions as anonymous
virtual_use_local_privs=YES #
# Uncomment this to enable any form of FTP write command.
write_enable=YES ## PAM file name
pam_service_name=vsftpd_virtual ## Home Directory for virtual users
user_sub_token=$USER
local_root=/ftp/virtual/$USER # You may specify an explicit list of local users to chroot() to their home
# directory. If chroot_local_user is YES, then this list becomes a list of
# users to NOT chroot().
chroot_local_user=YES ## Hide ids from user
hide_ids=YES
Save and exit the file.
Now create home directories for virtual users:
# mkdir -p /ftp/virtual/senthil
# chown -R ftp:ftp /ftp/virtual/senthil/
Start or restart vsftpd service:
# service vsftpd restart
Now try to login to FTP server using virtual user senthil with password centos:
# ftp 192.168.1.101
Connected to 192.168.1.101 (192.168.1.101).
220 Welcome to UNIXMEN FTP service.
Name (192.168.1.101:root): senthil
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>
Now you will able to login to FTP server with user senthil since i didn’t create any user called senthil.
Verify the log files using the following command:
# tail -f /var/log/secure
Sample output:
Dec 24 18:32:04 server vsftpd[3557]: pam_userdb(vsftpd_virtual:auth): user 'senthil' granted access
Login via your browser
Setup VSFTPD Server with Virtual Users On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3的更多相关文章
- Install LAMP Server (Apache, MariaDB, PHP) On CentOS/RHEL/Scientific Linux 7
Install LAMP Server (Apache, MariaDB, PHP) On CentOS/RHEL/Scientific Linux 7 By SK - August 12, 201 ...
- 在CentOS/RHEL/Scientific Linux 6下安装 LAMP
LAMP 是服务器系统中开源软件的一个完美组合.它是 Linux .Apache HTTP 服务器.MySQL 数据库.PHP(或者 Perl.Python)的第一个字母的缩写代码.对于很多系统管理员 ...
- Setup FTP Server On CentOS, RHEL, Scientific Linux 6.5/6.4/6.3
setsebool allow_ftpd_full_access onsetsebool -P ftp_home_dir on vsftpd (Very Secure File Transport P ...
- linux之 CentOS/RHEL/Scientific Linux 6 & 7上安装Telnet
声明: 在安装和使用Telnet之前,需要记住以下几点. 在公网(WAN)中使用Telnet是非常不好的想法.它会以明文的格式传输登入数据.每个人都可以看到明文.如果你还是需要Telnet,强烈建议你 ...
- setting up a IPSEC/L2TP vpn on CentOS 6 or Red Hat Enterprise Linux 6 or Scientific Linux
This is a guide on setting up a IPSEC/L2TP vpn on CentOS 6 or Red Hat Enterprise Linux 6 or Scientif ...
- 【Linux】YUM Repositories for CentOS, RHEL & Fedora Systems
这里是官方wiki:https://wiki.centos.org/AdditionalResources/Repositories 一.简介 YUM(Yellowdog Updater Modifi ...
- Setup and Configure the vsftpd server in CentOS 7 operation system
############################################################################## 1. close the firewall ...
- setup FTP server on CentOS 7
Setup FTP Server on CentOS 7 Install vsftpd vsftpd (Very Secure File Transport Protocol Daemon) is a ...
- How to setup vsftpd FTP file Server on Redhat 7 Linux
Forward from: https://linuxconfig.org/how-to-setup-vsftpd-ftp-file-server-on-redhat-7-linux How to s ...
随机推荐
- 零基础学习视频解码之FFMpeg中比较重要的函数以及数据结构
http://www.cnblogs.com/tanlon/p/3879081.html 在正式开始解码练习前先了解下关于FFmpeg中比较重要的函数以及数据结构. 1. 数据结构: (1) AVF ...
- MVC母版面,子页的脚本生成在最后
- java数据库连接池dbcp的使用
近年来,随着Internet/Intranet建网技术的飞速发展和在世界范围内的迅速普及,计算机 应用程序已从传统的桌面应用转到Web应用.基于B/S(Browser/Server)架构的3层开发模式 ...
- python中的lambda表达
C++中的lambda表达式与C++11增加标准库,是一个简短的匿名的可调用对象,编译器会将其转化为一个匿名类的对象.lambda表达式的最大特点就是简短灵活.调用方便.它不须要处理非常复杂的逻辑.通 ...
- LabVIEW的错误簇以及错误处理函数
我们可以在LabVIEW的Modern>>Array, Matrix & Cluster控件面板找到表示错误簇数据类型的错误输入(Error In)以及错误输出(Error Out ...
- 网站优化的经验和技巧--精简高效的C#
对大型网站,技术涉及面非常广,对硬件,软件,编程语言,Web Service,防火墙等等有很高要求. 面对大量用户,高并发请求,可以使用高性能服务器,高性能编程语言,高性能数据库,加大带宽等,这 ...
- Windows系统下搭建Jenkins环境
1. 安装JDK JDK下载地址: http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.ht ...
- 第二篇:web之前端之css
前端之css 前端之css 本节内容 css概述及引入 css选择器 css常用属性 1.css概述及引入 CSS概述 CSS是Cascading Style Sheets的简称,中文称为层叠样式 ...
- JavaScript+DOM编程艺术【读书笔记】
第四章笔记: 如何让一个a标签不跳转: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www. ...
- CSS自动控制图片大小的代码
img { max-width: 800px; height: auto; } 代码中的max-width:800px限制图片的最大宽度为800像素,而下面的hight:auto很关键,可以保证图片有 ...