zoukankan      html  css  js  c++  java
  • 配置ftp服务器只能上传不能进行其他操作

    又到期末考试了,今年当了数据挖掘助教,课程有一道编程大作业,需要搭建ftp服务器,实现文件上传,但是禁止下载重命名。
    服务器系统是ubuntu12.04 server,使用的ftp服务器也是linux下大名鼎鼎的vsftpd,配置如下:
    1创建用户dm,将其登录终端设置为/bin/false,防止用户ssh登录

    1
    useradd -m -s /bin/false dm

    2将/bin/false加入/etc/shells中,使其可以使用dm用户进行ftp登录

    1
    echo "/bin/bash">>/etc/shells

    3配置vsftpd.conf,禁止用户访问上层目录.自行创建/etc/vsftpd.chroot_list,不添加任何用户,在vsftpd.chroot_list中得用户可以切换到上层目录,我们这里需要禁止dm用户。主要配置如下:

    1
    2
    3
    chroot_local_user=YES
    chroot_list_enable=YES                                                                                                                                       
    chroot_list_file=/etc/vsftpd.chroot_list

    4添加相应权限,防止用户下载重命名
    使用cmds_allows命令配置,将不允许的命令(重命名,下载,删除,创建文件夹)除去即可:

    1
    cmds_allowed=FEAT,REST,CWD,LIST,MDTM,NLST,PASS,PASV,PORT,PWD,QUIT,RMD,SIZE,STOR,TYPE,USER,ACCT,APPE,CDUP,HELP,MODE,NOOP,REIN,STAT,STOU,STRU,SYST

    主要命令解释如下:

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    =====================最常用的,出去对应命令即可========================
    MKD - make a remote directory 新建文件夹
    NLST - name list of remote directory
    PWD - print working directory 显示当前工作目录
    RETR - retrieve a remote file 下载文件
    STOR - store a file on the remote host 上传文件 
    DELE - delete a remote file 删除文件
    RMD - remove a remote directory 删除目录
    RNFR - rename from 重命名
    RNTO - rename to 重命名
    ====================================================================
    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
    来源: <http://androiddevelop.cn/?p=796>




  • 相关阅读:
    常用函数
    PostgreSql那点事(文件读取写入、命令执行的办法)
    如何检测Windows中的横向渗透攻击
    小米笔记本pro版bios经常找不到硬盘
    grunt教程
    nodejs廖雪峰大神教程
    ClickOnce是什么?如何使用?
    asp.net中的ORA-12154: TNS: 无法解析指定的连接标识符
    未能加载文件或程序集 ICSharpCode.SharpZipLib
    PL/SQL 循环
  • 原文地址:https://www.cnblogs.com/jins-note/p/9512542.html
Copyright © 2011-2022 走看看