我想:
授予朋友 SFTP 访问他
/home/friend在我服务器上的目录的权限给他一个带有 Apache 的虚拟主机
/home/friend/www/不允许他访问
/etc/和类似的目录(目前已解决),也不允许他访问我自己用户的家/home/me(暂未解决)
去做这个:
我创建
adduser friend我为他添加了一个 Apache VirtualHost:
<VirtualHost *:80> ServerName hiswebsite.com DocumentRoot /home/friend/www ... </VirtualHost>和
service apache2 restart。我“关押”了 SFTP/SSH 访问:
PermitRootLogin yes ChallengeResponseAuthentication no UsePAM yes X11Forwarding yes PrintMotd no AcceptEnv LANG LC_* PasswordAuthentication yes GatewayPorts yes Subsystem sftp internal-sftp Match User friend ChrootDirectory /home/ ForceCommand internal-sftp和
service sshd restart。
问题:
friend现在不能出去了/home/(这样很好),但是他还是可以进去/home/me/看看里面的文件!如何只给他访问权限/home/friend/而没有其他权限?这似乎不可能,因为:ChrootDirectory
指定认证后chroot(2) 目录的路径名。 路径名的所有组成部分必须是 root 拥有的目录,任何其他用户或组都不可写。我是不是该
将用户添加
friend到组www-data?或将用户添加
www-data到组friend?或其他用户/组设置?
允许 Apache 提供文件,而 PHP 有写入权限
/home/friend/www/?假设他的网站上有一个文件上传器:PHP需要写在这个目录下。给予/home/friend和的哪些权限/home/me?
相关主题: