0

I have a server (Ubuntu 12.10) running multiple websites, each with a different account.

I've configured VSFTPD to chroot these users in their respective folders, and all is working fine. As an example, I got user "foobar" that owns /srv/example.com.

Now I want a second virtual user that can only access a subdirectory, like /srv/example.com/images but with same user, group and pemissions of "foobar".

Is that possible? Or is there a better way?

(Note that apache is running apache2-mpm-itk, so when I access www.example.com, apache is dropping privileges to user foobar)

1 Answer 1

1

You could simply create that second user with a home directory of /srv/example.com/images but with the same UID/GID numbers as user 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)
2
  • This seems to be a simple way to solve my problem. Any downsides of doing this? (I mean, is this a good practice?) Thank you
    – JohnKiller
    Nov 18, 2013 at 13:44
  • Many basic operations run around the UID/GID numbers and translate those numbers to human readable names. You can get interesting results when those mappings are one-to-many. Things shouldn't break, but for instance an ls -l may show foobar as the owner one time, and foobar2 a second time. An alternative could be to use your webserver configuration to create a single URL namespace from multiple file system locations, i.e. with an Apache Alias /images/ /home/foobar2/images/ and then owners don't need to match.
    – HBruijn
    Nov 18, 2013 at 14:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .