Local access services of linux ftp browsing and virtual accounts

Restrict local users to browse the root directory
/etc/vsftpd/vsftpd.conf
Local access services of linux ftp browsing and virtual accounts

Function: All users are locked into their own plus directory (not only in their own home directory, you can also look at other before modification)
Edit Limits browse the root user
vim / etc / vsftpd / chroot_list
Local access services of linux ftp browsing and virtual accountsLocal access services of linux ftp browsing and virtual accounts
add whitelist setting
chroot_local_user = YES --- > this parameter requires write permissions to add themselves to remove the directory
chroot_list_enable = YES
chroot_list_file = / etc / vsftpd / chroot_list ---> list the file path
Local access services of linux ftp browsing and virtual accounts
Local access services of linux ftp browsing and virtual accounts
users listed in / etc / vsftpd / chroot_list file, you can switch to a different directory

Local access services of linux ftp browsing and virtual accounts
Note ---> user is not listed in the document, you can not switch to another directory
Blacklist provided
chroot_local_user = NO
chroot_list_enable = YES
the chroot_list_file = / etc / the vsftpd / chroot_list ---> List file path
Local access services of linux ftp browsing and virtual accounts

Local access services of linux ftp browsing and virtual accounts
Users listed in the / etc / vsftpd / chroot_list file, can not switch to another directory
Local access services of linux ftp browsing and virtual accounts
Note ---> user is not listed in the document, you can switch to another directory
.


限制本地用户登录
功能:限制本地用户登录
注 ---> 限制本地用户设置
vim /etc/vsftpd/ftpusers 只默认黑名单设置 ---> 永久用户黑名单
vim /etc/vsftpd/user_list 白黑名单均可设置 ---> 用户临时黑名单
用户黑名单建立

userlist_enable=YES
Local access services of linux ftp browsing and virtual accounts

黑名单设置vim /etc/vsftpd/user_list ---> 用户临时黑名单
Local access services of linux ftp browsing and virtual accountsLocal access services of linux ftp browsing and virtual accounts
只默认黑名单 vim /etc/vsftpd/ftpusers ---> 永久用户黑名单
Local access services of linux ftp browsing and virtual accountsLocal access services of linux ftp browsing and virtual accounts
Local access services of linux ftp browsing and virtual accounts
Local access services of linux ftp browsing and virtual accounts
其他用户可登录
Local access services of linux ftp browsing and virtual accounts

用户白名单建立

userlist_enable=YES
userlist_deny=NO ---> 白名单功能建立
Local access services of linux ftp browsing and virtual accounts

用户白名单设定

vim /etc/vsftpd/user_list ##参数设定,此文件变成用户白名单,只在名单中出现的用户可以登录ftp
Local access services of linux ftp browsing and virtual accountsLocal access services of linux ftp browsing and virtual accounts
Local access services of linux ftp browsing and virtual accounts
只有白名单tom可以登录
Local access services of linux ftp browsing and virtual accounts
其他用户都不能登录
Local access services of linux ftp browsing and virtual accounts
.


ftp虚拟用户的设定
(创建虚拟帐号身份)
vim /etc/vsftpd/testfile ---> 文件名称任意
Local access services of linux ftp browsing and virtual accounts
user1
111
user2
222
user3
333
Local access services of linux ftp browsing and virtual accounts

db_load -T -t hash -f /etc/vsftpd/testfile /etc/vsftpd/testfile .db
Local access services of linux ftp browsing and virtual accounts
注 ---> 上面的密码是明文的,不安全,要进行加密,T表示transfer,t表示转换方式为hash
查看文件类型
Local access services of linux ftp browsing and virtual accounts

ps aux | grep pam
Local access services of linux ftp browsing and virtual accounts
注 ---> 系统里有pam这个进程的
cd /etc/pam.d ---> 查看vsftpd.conf,认证的时候是使用pam认证
Local access services of linux ftp browsing and virtual accounts
注 ---> cd /etc/pam.d,目录里有个vsftpd文件
---> 认证的时候就是在这个文件里做用户名和密码的比对
vim test
Local access services of linux ftp browsing and virtual accounts
account required pam_userdb.so db=/etc/vsftpd/testfile
auth required pam_userdb.so db=/etc/vsftpd/testfile
Local access services of linux ftp browsing and virtual accounts
注 ---> account表示帐号名称,auth表示密码,先后顺序不分
---> required是通过了用户名认证才能进入下一步认证,然后使用pam_userdb.so这个插件来验证
---> db=/etc/vsftpd/testfile 文件后不要写.db,系统会自动加

创建虚拟帐号身份
vim /etc/vsftpd/vsftpd.conf
虚拟帐号认证参考test认证文件
pam_service_name=test
开启虚拟账户功能
guest_enable=YES
Local access services of linux ftp browsing and virtual accounts
虚拟帐号没有身份指定时,登录共享目录
Local access services of linux ftp browsing and virtual accounts
虚拟帐号身份指定
设置家
guest_username=tom
Local access services of linux ftp browsing and virtual accounts
注 ---> 默认使用虚拟用户时,登录后在pub目录,要想改变,修改此参数,修改后登录到tom家目录
chmod u-w /home/ftpuser
Local access services of linux ftp browsing and virtual accountsLocal access services of linux ftp browsing and virtual accountsLocal access services of linux ftp browsing and virtual accounts
虚拟帐号家目录独立设定
vim /etc/vsftpd/vsftpd.conf
local_root=/ftphome/$USER

user_sub_token=$USER
vim /etc/vsftpd/vsftpd.conf
注 ---> $USER是shell里的用法,要让配置文件里支持,必须加这个参数
Local access services of linux ftp browsing and virtual accounts
创建user1,2的家目录
mkdir /ftphome/user1/pub1 -p
mkdir /ftphome/user2/pub2 -p

改目录权限为775,组为ftp
chgrp ftp /ftphome /user1/pub1
Local access services of linux ftp browsing and virtual accounts
chgrp ftp /ftphome /user2/pub2
Local access services of linux ftp browsing and virtual accounts

chmod 775 /ftphome/user1/pub1

Local access services of linux ftp browsing and virtual accounts
chmod 775 / ftphome / user2 / pub2
Local access services of linux ftp browsing and virtual accounts
virtual account configured independently
to create a configuration file
mkdir -p / etc / vsftpd / userconf
Local access services of linux ftp browsing and virtual accounts
profile user1 set
vim / etc / vsftpd / userconf / user1
Local access services of linux ftp browsing and virtual accounts
Note ---> set the configuration file in this file All parameters, a higher priority for this file
anon_upload_enable = YES
Local access services of linux ftp browsing and virtual accounts
user1 can upload
Local access services of linux ftp browsing and virtual accounts
user2 not
Local access services of linux ftp browsing and virtual accounts

Guess you like

Origin blog.51cto.com/14190777/2426092