如何在 Apache 服务器上为用户创建只读 FTP 访问?

发布于 2024-09-19 19:36:13 字数 460 浏览 2 评论 0原文

我有一个网站,里面有很多摄影页面。为了允许访问者下载一​​组照片,而不必单独保存每张照片,我想创建一个公开的只读 FTP 用户

通过主机的控制面板,我可以创建“常规”FTP 用户帐户,但它们具有写入权限,这是不可接受的。

由于同一服务器上托管有多个域和子域,我不想使用匿名 FTP - 只读 FTP 帐户应限制到特定目录/子目录

如果可能的话,我还想知道如何从我授予该新用户的只读 FTP 访问权限中排除特定目录

我查看了服务器上所有用户帐户信息的存储位置,但无济于事。具体来说,我查看了 httpd.conf,并找到了 LoadModule proxy_ftp_module module/mod_proxy_ftp.so,但我不知道如何使用它(或者它是否相关)。

I have a web site with lots of pages of photography. In order to allow visitors to download groups of photos without having to save each one individually, I want to create a read-only FTP user that will be publicly available.

Via the control panel for the host, I can create "regular" FTP user accounts, but they have write access, which is unacceptable.

Since there are several domains and subdomains hosted on the same server I don't want to use anonymous FTP -- the read-only FTP account should be restricted to a specific directory/sub-directories.

If possible, I would also like to know how to exclude specific directories from the read-only FTP access I grant to this new user.

I've looked all over on the server to find where user account info is stored to no avail. Specifically I looked in httpd.conf, and found LoadModule proxy_ftp_module modules/mod_proxy_ftp.so, but I don't know how to go about working with it (or if it's even relevant).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霞映澄塘 2024-09-26 19:36:13

您使用 FTP 的原因似乎是为了让人们同时下载许多照片。
您也可以使用标准 Apache HTTP 访问控制来提供 zip 文件的链接。这样,使用纯 HTTP 就可以消除您提到的人们删除或覆盖您的文件的特定风险。

您可以创建一个目录来提供要下载的 zip 文件的索引

<Directory /var/www/photos/>
    Order allow,deny
    Allow from all
    Options Indexes
</Directory>

,并对其余目录应用标准权限

# your file system is off limits 
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

DocumentRoot /var/www/

# the rest of your content.
<Directory /var/www/>
    <LimitExcept GET POST>
        deny from all
    </LimitExcept>

    Order allow,deny
    Allow from all
    Options None
</Directory>

It seems like your reason for using FTP is to let people download many photographs at once.
You can just serve links to zip files too, using standard Apache HTTP access control. This way the specific risk of people deleting or overwriting your files, which you mentioned, is eliminated by using plain HTTP.

You can make one directory to provide an index of the zip files to download

<Directory /var/www/photos/>
    Order allow,deny
    Allow from all
    Options Indexes
</Directory>

And apply standard permissions to the rest of your directories

# your file system is off limits 
<Directory />
    Options None
    AllowOverride None
    Order deny,allow
    Deny from all
</Directory>

DocumentRoot /var/www/

# the rest of your content.
<Directory /var/www/>
    <LimitExcept GET POST>
        deny from all
    </LimitExcept>

    Order allow,deny
    Allow from all
    Options None
</Directory>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文