linux 限制FTP用户切换目录 限制 登陆

该博客介绍了如何在Linux系统中使用vsftpd服务限制FTP用户zydc仅能在/home/zydc/GD/WX目录内活动。通过修改vsftpd配置文件,启用chroot_list_enable并设置chroot_list_file,确保zydc用户无法切换到其他目录。详细步骤包括创建用户、设置权限、修改vsftpd配置以及验证限制效果。
摘要由CSDN通过智能技术生成

1:useradd -d /home/zydc -s /sbin/nologin -m zydc
2:passwd zydc     
3:usermod -G ems zydc( 出于 安全,不用配置,防止第三方用户可以登陆ams文件)
4:按照规范要求用ems用户,命令mkdir 创建目录:
[ems@EMSBAK zydc]$ mkdir GD
 [ems@EMSBAK zydc]$ cd GD/
[ems@EMSBAK GD]$ mkdir WX
[ems@EMSBAK GD]$ ls
WX
[ems@EMSBAK GD]$ cd WX/
[ems@EMSBAK WX]$ ls

/home/zydc/GD/WX

5:chmod -R 777 /home/zydc  
6:chown -R ems:ems /home/zydc(/home/zydc 是文件目录)


测试账户:
[root@EMS-CMJXA1 cnnbi]# ftp 10.239.34.68
Connected to 10.239.34.68 (10.239.34.68).
220 (vsFTPd 2.2.2)
Name (10.239.34.68:root): zydc
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>

限制 zydc 用户,不能去其他目录,

第一步: 修改/etc/vsftpd/vsftpd.conf
将以下三行

#chroot_list_enable=YES
# (default follows)
#chroot_list_file=/etc/vsftpd.chroot_list

改为

chroot_list_enable=YES
# (default follows)
chroot_list_file=/etc/vsftpd/chroot_list

举例 :
[root@EMS log]# cd /etc/vsftpd/
[root@EMS vsftpd]# ls
ftpusers  user_list  vsftpd.conf  vsftpd_conf_migrate.sh
[root@EMS vsftpd]# vi vsftpd.conf
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
#
# Allow anonymous FTP? (Beware - allowed by default if you comment this out).
anonymous_enable=YES
#
# Uncomment this to allow local users to log in.
local_enable=YES
#
# Uncomment this to enable any form of FTP write command.
write_enable=YES

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值