I have a server where I have folders to be shared over local network (like Photos, Music etc.). I did the following:

cd /volumes1/Family/Photos
touch .chattrlock
sudo chattr +i .chattrlock

Now I cannot delete the folder "Photos" but I can still move it within the Family Share. Is there a way to prevent the Folder from being moved inside the share?

The folder's permissions should stay rwx.

  • Is it your goal to be able to add content to Photos? If so, chattr +i will be problematic. Commented Feb 22, 2018 at 23:58
  • Yes Timothy, I want to create new stuff inside Photos
    – swift_dan
    Commented Feb 23, 2018 at 10:10

1 Answer 1


If a folder itself is not immutable but one or more files inside of it are then you can't delete it but you can, in fact, move or modify it.

If you want to make it so that the Photos folder itself can't being moved or deleted but you still want to create files inside of it then you'll need the following command:

chattr +a Photos

That will make it so that the folder can't be renamed, moved, or deleted but will allow you to create and modify files inside of it unless the files themselves are immutable. If you want to delete files inside then you'll need to first chattr -a Photos and then chattr +a Photos after you're done.

  • Thanks @Nasir, but in fact I can't create any new folder inside "Photos".
    – swift_dan
    Commented Feb 23, 2018 at 10:10
  • I've edited my answer. Commented Feb 23, 2018 at 10:55
  • Thanks, I will try that :) I stumbled the man-pages but somehow I did not come accross this
    – swift_dan
    Commented Feb 23, 2018 at 11:11
  • 2
    The man page doesn't actually give any details on what the a flag does for directories. It only says what it does for files. The only way to find out is by trial and error. Commented Feb 23, 2018 at 12:29

You must log in to answer this question.

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