【问题标题】:How to use regular expression for directory paths in proftpd如何在proftpd中使用正则表达式作为目录路径
【发布时间】:2011-11-14 13:50:36
【问题描述】:

我的站点上有一些目录,我希望匿名 ftp 用户可以访问它们,但它们不应该是可见的。所以我不希望他们在输入“ls”或“dir”时出现,但我希望用户能够输入“cd secret_dir”。

我希望这样做

ServerName              "ProFTPD Default Installation"
ServerType              standalone
DefaultServer           on
Port                21
Umask               022
MaxInstances            30

# Set the user and group under which the server will run.
User                nobody
Group               nogroup

RequireValidShell           off

# Normally, we want files to be overwriteable.
<Directory />
  AllowOverwrite            on
</Directory>

<Anonymous /home/ftp/my.site.org>
  User              ftp
  Group             planonline

  UserAlias             anonymous ftp
  MaxClients            10

  DisplayLogin          welcome.msg
  DisplayChdir          .message

  # So users can't do ls in the directory
  <Limit ALL>
    DenyAll
  </Limit>

  # All have access to this directory, for testing permissions
  <Directory "/home/ftp/my.site.org/uuid-files/00000000-0000-0000-0000-000000000000/00000000-0000-0000-0000-000000000000">
  <Limit ALL>
    AllowAll
  </Limit>
  </Directory>

  # I want this to work but it doesn't
  <Directory "/home/ftp/my.site.org/uuid-files/[0-9a-f]">
    <Limit ALL>
      AllowAll
    </Limit>
  </Directory>
</Anonymous>

用户 ftp 和组 planonline 拥有这些文件。我无法更改任何这些权限,因为它们将由另一个创建目录的应用程序设置。目录的权限如下所示:

sskanberg@ubuntu-develop:/home/ftp$ ls -l
total 8
-rwxr--r-- 1 ftp planonline    4 2011-11-14 13:15 ftpdir.txt
drwxrwxr-- 3 ftp planonline 4096 2011-11-14 13:08 my.site.org

所以我的问题是:如何在我的目录标签中使用正则表达式?或者,我怎样才能通过其他方式实现我的愿望:使目录对 ftp 用户不可见,但仍然能够 cd'ing 进入它们?

【问题讨论】:

    标签: regex linux ftp


    【解决方案1】:

    您是否尝试过使用HideFiles?我猜它应该像这样使用:

    <Directory "/home/ftp/my.site.org/uuid-files">
      HideFiles ^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
      <Limit ALL>
        AllowAll
        IgnoreHidden on
      </Limit>
    </Directory>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2017-06-19
      • 2019-03-26
      • 1970-01-01
      • 2021-06-17
      • 1970-01-01
      • 1970-01-01
      • 2019-05-12
      相关资源
      最近更新 更多