2011-11-14 27 views
3

我在我的網站上有一些目錄我想可以被匿名ftp用戶訪問,但它們不應該是可見的。所以我不希望他們在輸入「ls」或「dir」時顯示,但我希望用戶能夠鍵入「cd secret_dir」。如何在proftpd中使用正則表達式的目錄路徑

我希望這會做

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擁有這些文件。我無法更改任何這些權限,因爲它們將由另一個創建目錄的應用程序設置。目錄的權限是這樣的:

[email protected]:/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用戶無法看到目錄,但是仍然能夠對他們進行切入?

回答

0

您是否嘗試過使用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>