vsftpd安装及本地用户不同权限配置

  • 操作系统 CentOS7.4
  1. 安装 yum install vsftpd -y

  2. 配置vsftpd.conf
    egrep -v “#|$” ** /etc/vsftpd/vsftpd.conf **
    anonymous_enable=NO
    anon_upload_enable=NO
    anon_mkdir_write_enable=NO
    write_enable=YES
    local_umask=000
    local_enable=YES
    dirmessage_enable=YES
    xferlog_enable=YES
    connect_from_port_20=YES
    xferlog_std_format=YES
    chroot_local_user=YES
    chroot_list_enable=YES
    chroot_list_file=/etc/vsftpd/chroot_list #在此文件中的用户可以cd 到自己的家目录外
    listen=YES
    pam_service_name=vsftpd
    userlist_enable=YES
    tcp_wrappers=YES
    allow_writeable_chroot=YES
    user_config_dir=/etc/vsftpd/userconfig #为每个用户分配特定的权限的目录 下面放置和用户名相同的文件来限制每个用户的权限

  3. 创建本地账号test,并设置密码
    useradd -d /data/ftp/test -m -s /sbin/nologin test
    echo “test” | passwd --stdin test
    此时登录 使用test 账号登录 默认根目录是 /data/ftp/test,并被锁定到根目录下,如果需要切换到根目录外可以把此用户名 写入chroot_list_file=/etc/vsftpd/chroot_list 这个文件中。
    /etc/vsftpd/user_list 按照第二部配置的此时为 黑名单
    /etc/vsftpd/ftpusers 黑名单(/etc/pam.d/vsftpd中配置)

  4. 单独与test 账号设置权限
    mkdir -p /etc/vsftpd/userconfig
    cd /etc/vsftpd/userconfig
    touch test
    更改test 用户的登录的根目录:
    local_root=/data/test
    设置test 用户只能上传,禁止改名,删除,新建等 cmds_allowed=FEAT,REST,CWD,LIST,MDTM,MKD,NLST,PASS,PASV,PORT,PWD,QUIT,RMD,SIZE,STOR,TYPE,USER,ACCT,APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST

  • 以下是常用的一些参数,仅供参考!
    ABOR - abort a file transfer 取消文件传输
    CWD - change working directory 更改目录
    DELE - delete a remote file 删除文件
    LIST - list remote files 列目录
    MDTM - return the modification time of a file 返回文件的更新时间
    MKD - make a remote directory 新建文件夹
    NLST - name list of remote directory
    PASS - send password
    PASV - enter passive mode
    PORT - open a data port 打开一个传输端口
    PWD - print working directory 显示当前工作目录
    QUIT - terminate the connection 退出
    RETR - retrieve a remote file 下载文件
    RMD - remove a remote directory
    RNFR - rename from
    RNTO - rename to
    SITE - site-specific commands
    SIZE - return the size of a file 返回文件大小
    STOR - store a file on the remote host 上传文件
    TYPE - set transfer type
    USER - send username
    less common commands:
    ACCT* - send account information
    APPE - append to a remote file
    CDUP - CWD to the parent of the current directory
    HELP - return help on using the server
    MODE - set transfer mode
    NOOP - do nothing
    REIN* - reinitialize the connection
    STAT - return server status
    STOU - store a file uniquely
    STRU - set file transfer structure
    SYST - return system type
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值