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 ...
随机推荐
- usaco 安慰奶牛
Description 约翰有N个牧场,编号依次为1到N.每个牧场里住着一头奶牛.连接这些牧场的有P条 道路,每条道路都是双向的.第j条道路连接的是牧场Sj和Ej,通行需要Lj的时间.两牧场之 间最多 ...
- PC-修改IE 与 禁止修改IE
1.注册表编辑器1.1在Windows启动后1.2点击“开始”1.3“运行”菜单项1.4在“打开”栏中键入“regedit”1.5然后按“确定”键 2.首页项2.1展开注册表到“HKEY_LOCAL_ ...
- 使用webdav实现文档共享
1.PC1上开启WebDAV的服务,添加创建规则:运行访问的路径.运行访问的用户(这里的用户是指PC1上的用户名和密码).访问权限
- PTA 07-图4 哈利·波特的考试 (25分)
哈利·波特要考试了,他需要你的帮助.这门课学的是用魔咒将一种动物变成另一种动物的本事.例如将猫变成老鼠的魔咒是haha,将老鼠变成鱼的魔咒是hehe等等.反方向变化的魔咒就是简单地将原来的魔咒倒过来念 ...
- centos中使用python遇到的几个问题
用python搞了一个从excel中读取cobbler节点信息并加入cobbler中的脚本,运行的过程中出了不少问题,这里记录下来,方便日后查找! 一.yum install python,我通过这个 ...
- C# 动态创建出来的窗体间的通讯 delegate1
附件 http://files.cnblogs.com/xe2011/CSharp_WindowsForms_delegate01.rar 需要每个窗体是独立存在,禁止相与引用窗体 这样干净并且可以反 ...
- android82 启动Actvity和Activity的生命周期
package com.itheima.jump; import android.net.Uri; import android.os.Bundle; import android.app.Activ ...
- 介绍 JSON
出自官网:http://www.json.org/json-zh.html JSON(JavaScript Object Notation) 是一种轻量级的数据交换格式. 易于人阅读和编写.同时也易于 ...
- ubuntu中安装eclipse 分类: android ubuntu linux 学习笔记 2015-07-07 10:19 75人阅读 评论(0) 收藏
上一篇说了安装jdk的事,于是趁热打铁,决定把eclipse也安装了. 下载这一系列就不用说了. 下载完成之后: 然后解压,解压之后文件剪切到/usr/software文件夹中,同时重命名为eclip ...
- oracle用户管理入门
1.创建一个新用户(普通) create user 用户名 identified by 密码 示例,创建一个名叫小明的用户,密码为xm 2.以管理员的身份给普通用户修改密码(当普通用户忘掉自己的密码时 ...