我有一台服务器(Ubuntu 12.10)运行多个网站,每个网站都有不同的帐户。
我已将 VSFTPD 配置为将这些用户 chroot 到其各自的文件夹中,一切运行正常。例如,我获得了拥有 /srv/example.com 的用户“foobar”。
现在我想要第二个虚拟的只能访问子目录的用户,例如 /srv/example.com/images,但具有与“foobar”相同的用户、组和权限。
这可能吗?或者有更好的方法吗?
(请注意,apache 正在运行 apache2-mpm-itk,因此当我访问 www.example.com 时,apache 会将权限授予用户 foobar)
答案1
您可以简单地创建第二个用户,其主目录为 /srv/example.com/images,但其 UID/GID 号码与用户 foobar 相同。
# id foobar
uid=500(foobar) gid=500(foobar) groups=500(foobar)
# adduser -o -u 500 -g 500 -d /srv/example.com/images foobar2
adduser: warning: the home directory already exists.
Not copying any file from skel directory into it.
# id foobar2
uid=500(foobar) gid=500(foobar) groups=500(foobar)