成功设置 proftpd 服务器后,我想为每个用户添加初始目录,我有 2 个用户,webadmin 可以访问所有文件夹,upload 只能访问 upload 文件夹
...
# Added config
DefaultRoot ~
RequireValidShell off
AuthUserFile /etc/proftpd/passwd
# VALID LOGINS
<Limit LOGIN>
AllowUser webadmin, upload
DenyALL
</Limit>
<Directory /home/webadmin>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ WRITE>
AllowUser webadmin
</Limit>
</Directory>
<Directory /home/webadmin/upload>
<Limit ALL>
DenyAll
</Limit>
<Limit DIRS READ WRITE>
AllowUser upload
</Limit>
</Directory>
一切设置好,但我需要告诉我的 ftp 客户端每个用户的初始目录(否则它将无法检索目录),我认为应该为每个用户自动设置(无需在 ftp 客户端中输入初始目录)
答案1
看起来您正在将它们的根目录设置为各自的主目录,我建议在他们的主文件夹中添加一个符号链接,该符号链接指向您希望它们定向到的文件夹。(如果您可以删除它们的主目录并将它们符号链接为这些文件夹。此外,您可能还需要允许访问他们的主文件夹。我想是的,但不确定。
更新您可以使用两个虚拟主机来划分两个用户,然后为每个用户设置默认根。
<VirtualHost my.per-user.virtual.host.address>
# the next line limits all logins to this virtual host, so that only
anonftp users can connect
<Limit LOGIN>
DenyGroup !anonftp
</Limit>
# limit access to each user's anon-ftp directory, we want read-only
except on incoming
<Directory ~/anon-ftp>
<Limit WRITE>
DenyAll
</Limit>
</Directory>
# permit stor access to each user's anon-ftp/incoming directory,
but deny everything else
<Directory ~/anon-ftp/incoming>
<Limit STOR>
AllowAll
</Limit>
<Limit READ WRITE>
DenyAll
</Limit>
</Directory>
# provide a default root for all logins to this virtual host.
DefaultRoot ~/anon-ftp
# Finally, force all logins to be anonymous for the anonftp group
AnonymousGroup anonftp
</VirtualHost>