Restricting users to their own home directories / not letting users view other users files...?

Roland Smith rsmith at xs4all.nl
Wed Feb 11 12:25:11 PST 2009


On Wed, Feb 11, 2009 at 01:23:23PM -0600, Paul Schmehl wrote:
> --On Wednesday, February 11, 2009 12:38:33 -0600 Keith Palmer 
> <keith at academickeys.com> wrote:
>
> > ... really? Write a script to copy the user's files over on a schedule...?
> >
> > I can see where that might be an option for some people, but that's
> > entirely not an option in this case. I'd have to schedule it to run every
> > 5 seconds or something to keep users from getting upset.
> >
> >
> > What if I symlinked each home user's public_html directory to a directory
> > readable only by Apache? Would Apache be able to read the destination
> > directory via the symlink, even if it doesn't have permission to access
> > the destination directory?
> >
> 
> Why can't you chgroup and setgid the homedirs to www?  (Or whatever
> account the web server is running under.)  You really have two
> requirements:
> 
> 1) Users can't see other users' files
> 2) The web server can read all users' web files
> 
> So you chmod the homedirs to 750/640, and chgroup the dirs and files
> to www, then set the sticky bit for the group, and you're done.  

According to the chgrp manual: 

     The user invoking chgrp must belong to the specified group and be the
     owner of the file, or be the super-user.

So if a non-root user wanted to add a new file, he'd have to be in the
www group to chgrp! Which would give other users (who'd also have to be
in the www group) at least read access to these files. And possilby to
other files used by apache as well.

Now for these webpages giving other reads access shouldn't be that much of
a problem. Since these are webpages they are presumably _meant_ to be
read by others. But giving all the users access to files belonging to
apache, that might not be desirable?

The thing is that the user would need to know that they have to chown
and chmod any new file/dir they create in public_html. For the average
windows user that would probably be too much to ask for.

Roland
-- 
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090211/36ec2415/attachment.pgp


More information about the freebsd-questions mailing list