Home php教程 php手册 借宝地,存放一下vsftpd+mysql的虚拟用户配置记录

借宝地,存放一下vsftpd+mysql的虚拟用户配置记录

Jun 13, 2016 am 09:53 AM
one time store user of virtual Record Configuration




借宝地,存放一下vsftpd+mysql的虚拟用户配置记录
解决方法
1.安装vsftpd yum install vsftpd就ok
2.需要pam_mysql组件,在这里
3.编译参数看下INSTALL 我这里用了一个参数就 withmysql=/usr/local/amp/mysql5
4.建立mysql数据库、表 db=vsftpd table=users(username,userpass,homedir),建立对应mysql帐户 vsftpd vsftpd(当然也可以用root或者现有帐户)
5.修改/etc/pam.d/vsftpd 新增两行 auth required /usr/lib/security/pam_mysql.so user=vsftpd passwd=vsftpd host=localhost db=vsftpd table=users usercolumn=username passwdcolumn=userpass

account required /usr/lib/security/pam_mysql.so user=vsftpd passwd=vsftpd host=localhost db=vsftpd table=users usercolumn=username passwdcolumn=userpass


复制代码6.建立用来存放虚拟用户配置文件的文件夹,我的在/etc/vsftpd/virtual,里面放了一个配置文件模板叫_tpl write_enable=YES

anon_mkdir_write_enable=YES

anon_upload_enable=YES

anon_other_write_enable=YES


复制代码意思是,就差一个homedir了
7.打开/etc/vsftpd/vsftpd.conf,设置修改为 #一定要有

listen=YES

#listen_port=10021

connect_from_port_20=YES

#服务器提示

ftpd_banner=Welcome to My FTP server.

#关闭匿名访问

anonymous_enable=NO

local_enable=YES

write_enable=NO

anon_upload_enable=NO

anon_mkdir_write_enable=NO

anon_other_write_enable=NO

chroot_local_user=YES

guest_enable=YES

#虚拟用户所使用的帐号,如果这里是root,那你传上去的文件所有者也是root,

#一般安全情况下,请设立单独的vsftpd的用户,就像mysql的独立访问用户一样

guest_username=root

pasv_min_port=30000

pasv_max_port=30999

#这里对应着/etc/pam.d/下的那个vsftpd 见第6条

pam_service_name=vsftpd

#虚拟用户配置文件目录

user_config_dir=/etc/vsftpd/virtual

xferlog_enable=YES

#xferlog_file=/var/log/vsftpd.log

xferlog_file=/data1/logs/vsftpd/vsftpd.log

anon_world_readable_only=NO

anon_umask=022

file_open_mode=0777

local_umask=022

#20080811 last modify

data_connection_timeout=120


复制代码要注意这里,local_umask和anon_umask的值
你的文件上传之后的权限值 = 777 local_umask,也就是,上例中的022,你上传之后,文件权限会是755
8./etc/vsftpd/vsftpd restart
9.我这里还有两个shell,但是我的bash很笨,if判断会有错误
增加ftp用户 #!/bin/bash

clear

echo "******************************"

echo "* Add vsftpd User Script *"

echo "* AnVy 2008.0516 *"

echo "******************************"



echo "Enter user account:[Enter Key]"

read username

echo "Username is $username, Now Enter the password:[Enter Key]"

read userpass

echo "Asign the user's ftp home directory:[Enter Key]"

read home

echo "create this dir?[y/n]:"

read $cd

if [ $cd="y" ]

then

mkdir $home

fi

#chown R www:www $home

/usr/local/amp/mysql5/bin/mysql uvsftpd pvsftpd
use vsftpd;

replace into users (username,userpass,homedir) values ('$username','$userpass','$home');

\q

EOF

cp /etc/vsftpd/virtual/_tpl /etc/vsftpd/virtual/$username

#在用户配置文件追加家目录配置参数

echo "local_root=$home" >> /etc/vsftpd/virtual/$username

echo "$username with homedir= $home was added."


复制代码ftp帐户列表以及删除用户 #!/bin/bash

clear

echo "******************************"

echo "* Add vsftpd User Script *"

echo "* AnVy 2008.0516 *"

echo "******************************"

echo "UserList:"

/usr/local/amp/mysql5/bin/mysql uvsftpd pvsftpd
use vsftpd;

select * from users;

\q

EOF

echo "Delete user account:[Enter Key]"

read username

/usr/local/amp/mysql5/bin/mysql uvsftpd pvsftpd
use vsftpd;

delete from users where username='$username';

\q

EOF

unlink /etc/vsftpd/virtual/$username

echo "$username without homedir was removed."


复制代码以上设置,可以简单实现我的虚拟用户分配,我也不太懂什么高深的设置
这样就可以实现我输入用户名,密码,家目录,就能开vsftpd帐户了,而且文件上传之后权限是755, 完全可用。

[ ]
附件: 您所在的用户组无法下载或查看附件

D8888D回贴内容
\q请一定要换成半角
D8888D回贴内容
不错,我配置的时候可没弄这么自动加账户,直接就手动配置的,反正这东西也不总变。

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1668
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
How to use Xiaohongshu account to find users? Can I find my mobile phone number? How to use Xiaohongshu account to find users? Can I find my mobile phone number? Mar 22, 2024 am 08:40 AM

With the rapid development of social media, Xiaohongshu has become one of the most popular social platforms. Users can create a Xiaohongshu account to show their personal identity and communicate and interact with other users. If you need to find a user’s Xiaohongshu number, you can follow these simple steps. 1. How to use Xiaohongshu account to find users? 1. Open the Xiaohongshu APP, click the "Discover" button in the lower right corner, and then select the "Notes" option. 2. In the note list, find the note posted by the user you want to find. Click to enter the note details page. 3. On the note details page, click the "Follow" button below the user's avatar to enter the user's personal homepage. 4. In the upper right corner of the user's personal homepage, click the three-dot button and select "Personal Information"

Where can I view the records of things I have purchased on Pinduoduo? How to view the records of purchased products? Where can I view the records of things I have purchased on Pinduoduo? How to view the records of purchased products? Mar 12, 2024 pm 07:20 PM

Pinduoduo software provides a lot of good products, you can buy them anytime and anywhere, and the quality of each product is strictly controlled, every product is genuine, and there are many preferential shopping discounts, allowing everyone to shop online Simply can not stop. Enter your mobile phone number to log in online, add multiple delivery addresses and contact information online, and check the latest logistics trends at any time. Product sections of different categories are open, search and swipe up and down to purchase and place orders, and experience convenience without leaving home. With the online shopping service, you can also view all purchase records, including the goods you have purchased, and receive dozens of shopping red envelopes and coupons for free. Now the editor has provided Pinduoduo users with a detailed online way to view purchased product records. method. 1. Open your phone and click on the Pinduoduo icon.

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

Log in to Ubuntu as superuser Log in to Ubuntu as superuser Mar 20, 2024 am 10:55 AM

In Ubuntu systems, the root user is usually disabled. To activate the root user, you can use the passwd command to set a password and then use the su- command to log in as root. The root user is a user with unrestricted system administrative rights. He has permissions to access and modify files, user management, software installation and removal, and system configuration changes. There are obvious differences between the root user and ordinary users. The root user has the highest authority and broader control rights in the system. The root user can execute important system commands and edit system files, which ordinary users cannot do. In this guide, I'll explore the Ubuntu root user, how to log in as root, and how it differs from a normal user. Notice

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Oracle Database: Can one user have multiple tablespaces? Oracle Database: Can one user have multiple tablespaces? Mar 03, 2024 am 09:24 AM

Oracle database is a commonly used relational database management system, and many users will encounter problems with the use of table spaces. In Oracle database, a user can have multiple table spaces, which can better manage data storage and organization. This article will explore how a user can have multiple table spaces in an Oracle database and provide specific code examples. In Oracle database, table space is a logical structure used to store objects such as tables, indexes, and views. Every database has at least one tablespace,

Analysis of user password storage mechanism in Linux system Analysis of user password storage mechanism in Linux system Mar 20, 2024 pm 04:27 PM

Analysis of user password storage mechanism in Linux system In Linux system, the storage of user password is one of the very important security mechanisms. This article will analyze the storage mechanism of user passwords in Linux systems, including the encrypted storage of passwords, the password verification process, and how to securely manage user passwords. At the same time, specific code examples will be used to demonstrate the actual operation process of password storage. 1. Encrypted storage of passwords In Linux systems, user passwords are not stored in the system in plain text, but are encrypted and stored. L

See all articles