资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

基于本地用户的vsftpd搭建-创新互联

要求:

分宜网站制作公司哪家好,找创新互联!从网页设计、网站建设、微信开发、APP开发、成都响应式网站建设公司等网站项目制作,到程序开发,运营维护。创新互联于2013年创立到现在10年的时间,我们拥有了丰富的建站经验和运维经验,来保证我们的工作的顺利进行。专注于网站建设就选创新互联

  一、禁止匿名账号和系统账号登录FTP服务器

  二、普通账号被禁锢在家目录

  三、开启指定用户能切换到其他目录

  四、设置系统登录日志记录

1、安装

#yum install vsftpd lftp -y
#rpm -ql vsftpd
/etc/logrotate.d/vsftpd
/etc/pam.d/vsftpd
/etc/rc.d/init.d/vsftpd
/etc/vsftpd
/etc/vsftpd/ftpusers
/etc/vsftpd/user_list
/etc/vsftpd/vsftpd.conf
/etc/vsftpd/vsftpd_conf_migrate.sh
/usr/sbin/vsftpd
/usr/share/doc/vsftpd-2.2.2
/usr/share/doc/vsftpd-2.2.2/AUDIT
/usr/share/doc/vsftpd-2.2.2/BENCHMARKS
/usr/share/doc/vsftpd-2.2.2/BUGS
/usr/share/doc/vsftpd-2.2.2/COPYING
/usr/share/doc/vsftpd-2.2.2/Changelog
/usr/share/doc/vsftpd-2.2.2/EXAMPLE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/PER_IP_CONFIG/hosts.allow
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_HOSTS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/README.configuration
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/logins.txt
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2
/usr/share/doc/vsftpd-2.2.2/EXAMPLE/VIRTUAL_USERS_2/README
/usr/share/doc/vsftpd-2.2.2/FAQ
/usr/share/doc/vsftpd-2.2.2/INSTALL
/usr/share/doc/vsftpd-2.2.2/LICENSE
/usr/share/doc/vsftpd-2.2.2/README
/usr/share/doc/vsftpd-2.2.2/README.security
/usr/share/doc/vsftpd-2.2.2/REWARD
/usr/share/doc/vsftpd-2.2.2/SECURITY
/usr/share/doc/vsftpd-2.2.2/SECURITY/DESIGN
/usr/share/doc/vsftpd-2.2.2/SECURITY/IMPLEMENTATION
/usr/share/doc/vsftpd-2.2.2/SECURITY/OVERVIEW
/usr/share/doc/vsftpd-2.2.2/SECURITY/TRUST
/usr/share/doc/vsftpd-2.2.2/SIZE
/usr/share/doc/vsftpd-2.2.2/SPEED
/usr/share/doc/vsftpd-2.2.2/TODO
/usr/share/doc/vsftpd-2.2.2/TUNING
/usr/share/doc/vsftpd-2.2.2/vsftpd.xinetd
/usr/share/man/man5/vsftpd.conf.5.gz
/usr/share/man/man8/vsftpd.8.gz
/var/ftp
/var/ftp/pub

2、配置

#sed '{/^#/d;/^$/d}' /etc/vsftpd/vsftpd.conf
anonymous_enable=NO                             #设定不让匿名登录
local_enable=YES                                #指定在/etc/passwd内的账号才能以真实用户登录
write_enable=YES                                #允许用户上传文件与目录
local_umask=022                                 #建立新目录755和文件644权限     
dirmessage_enable=YES                           #若目录下有.message则会显示其中的内容
connect_from_port_20=NO                         #支持主动式联机功能
xferlog_enable=YES                              #启动登录文件记录,记录于/var/log/xferlog
dual_log_enable=YES                             #启用独立日志功能
vsftpd_log_file=/var/log/vsftpd.log             #ftp访问日志位置
xferlog_file=/var/log/xferlog                   #登录日志位置
xferlog_std_format=YES                          #支持wuftp日志格式,可以使用wuftp登录文件的分析软件
chroot_list_enable=YES                          #启用chroot禁锢用户列表模式,和下项配合使用
chroot_list_file=/etc/vsftpd/chroot_list        #如果为YES,设定不被chroot用户列表
chroot_local_user=YES                           #限制默认用户chroot
pasv_enable=YES                                 #支持数据流的被动连接模式
pasv_min_port=40000                             #被动连接模式支持的
pasv_max_port=40080                             端口范围
pasv_promiscuous=YES                            #禁用pasv检查
listen=YES                                      #独立进程启动
listen_port=10090                               #使用命令通道端口,服务器侦听端口
pam_service_name=/etc/pam.d/vsftpd              #pam模块名称
userlist_enable=YES                             #开启userlist机制管理登录账号
userlist_deny=YES                               #默认YES,拒绝列表
userlist_file=/etc/vsftpd/user_list             #列表位置
tcp_wrappers=YES                                #支持tcp wrappers的防火墙机制
max_clients=10                                  #最多支持10个用户的连接
max_per_ip=50                                   并且一个用户最多50的连接

3、新建测试账号

#useradd nagios
#echo 'nagios' | passwd --stdin nagios
Changing password for user nagios.
passwd: all authentication tokens updated successfully.

4、不受chroot控制的用户

#cat /etc/vsftpd/chroot_list
nagios

5、测试

#lftp -p 10090 -u nagios,nagios ServerIP
#lftp nagios@192.168.100.10:~> ls
-rw-r--r--    1 501      501          1578 May 05 03:41 passwd
-rw-r--r--    1 501      501           220 May 05 03:41 rc.localcheng
lftp nagios@ServerIP:~cd /etc/
cd ok, cwd=/etc
lftp nagios@ServerIP:/etc> pwd

逃离Home成功

6、一般用户测试

# lftp -p 10090 -u cytxmanager,centos ServerIP
lftp cytxmanager@ServerIP:~> ls
-rw-r--r--    1 500      500          1578 May 05 03:14 passwd
lftp cytxmanager@ServerIP:/> cd /etc/
cd: Access failed: 550 Failed to change directory. (/etc)

被chroot

另外有需要云服务器可以了解下创新互联scvps.cn,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网页题目:基于本地用户的vsftpd搭建-创新互联
链接地址:http://cdkjz.cn/article/dessdh.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220