This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: /home security problem
On 02/09/2010 22:22, Andy Koppe wrote:
> The /home directory has rwxrwxrwt rights. This allows anyone to create
> directories and files in /home, but due to the 'sticky' bit
> represented by the 't' at the end, only directory/file owners can
> delete them. So this allows /etc/profile to create a user's home
> directory, without allowing users to remove other users' home
> directories.
>
> Trouble is, users can create directories with any name in /home,
> including directories with the name of another user who hasn't yet
> logged in. When that user eventually does log in, (s)he'll end up with
> a home directory owned by someone else. This even works for
> administrators, i.e. I ended up being able as an ordinary user to
> delete files in an administrator's home directory.
>
> I've got no idea how to fix that short of changing the /home
> permissions to 775 and hence requiring an administrator to create any
> home directories (which of course is what happens on Linux).
We could restructure the logic in /etc/profile to do something like
if [ $HOME already exists ]
if [ $HOME owner uid != $user uid ]
issue warning and rename bogus home dir aside
fi
fi
just before the current
if [ $HOME doesn't exist ]
copy it from /etc/skel, issuing the standard first-run message.
fi
bit. (Sorry pseudocode only.)
cheers,
DaveK