Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I disallow a user from moving/renaming a subdirectory of this home directory?

Even if a user doesn't have any rights on a directory, it can rename/move it as long as the source and destination parent directory are writable.

I had a similar problem on macosx. Users inadvertently drag&drop the "Library" folder somewhere else breaking everything as there are applications depending on that path.

I don't it would be better to depend on another path, outside the home dir, or use ".files" but I have a legacy situation.

I tried to fix the problem my putting the dir somewhere else and then making a "bind" mount

mount -o bind sourcepath /home/user/somedir

It prevents the renaming of the dir:

mv: cannot move `somedir' to `somethingelse': Device or resource busy

Does anybody know an easier way?

share|improve this question
up vote 2 down vote accepted

Easiest is probably using chattr:

sudo mkdir /home/user/somedir
sudo chown root:root /home/user/somedir
sudo chattr +i /home/user/somedir
share|improve this answer
Does this require mounting with extended attributes? Does Ubuntu mount with xattrs by default? – Ryan Thompson Nov 1 '10 at 19:04
ok it solves the problem for me since I don't have to let the user create direct children in this directory – ithkuil Nov 1 '10 at 19:05
Ubuntu mounts with xattr by default, but not user xattrs. – Kees Cook Nov 1 '10 at 19:13
does this work with acl (access control lists) as well? – RolandiXor Nov 1 '10 at 19:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.