[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Changing permission in user's home directory

I want to change permission of a directory, recursively. The directory is a 
subdirectory of a user's home directory.

Is there a way to do this in a secure and easy way with the user having full 
write access to the home directory?

Let's assume I would change the permissions as follows
$ chgrp -R www-data ~user/subdir
$ chmod -R g+rwX ~user/subdir

The issue is that the user could do something like this beforehand:
$ mv ~user/subdir ~user/subdir2
$ ln -s / ~user/subdir

Not a very nice thing to do, is it?

Well, I could just change the user's permission for the home directory as 
$ chown root:users-group ~user
$ chmod g+rwx,+t

But this seems rather error-prone. Especially because I would have to adjust 
the permission of quite a lot of directories, some of which are not even in 
the top level of the users' home directories. Frankly, me forgetting to adjust 
the permissions of a few directories is just to great.

What I now would like to know is, is there an easier way to solve the issue. 
Like teaching chmod not to follow links. Unfortunately, I haven't found a --
make-sure-as-hell-not-to-follow-links-in-any-way parameter or anything the 

Reply to: