Let's suppose we have to users: alice and bob.

Now Bob wants to move Alice's ~/Documents directory into his home folder.

What's the best workflow to do that, updating the permissions (from Alice to Bob)?

That means that all the rights Alice has on the /home/alice/Documents/ (directories and files, recursively) to be added to Bob /home/bob/Documents/ (directories and files, recursively), and Alice's rights will be removed from /home/bob/Documents.

  • Can you update your question with your interpretation of what are correct permissions? You only talk about ownership in the body of your post. – Anthon Jan 18 '15 at 19:07
  • @Anthon I just want to migrate Alice's files to Bob. So, probably only the ownership is the issue. – Ionică Bizău Jan 18 '15 at 19:40

If you change the file owner using chown, the permissions for alice would be transferred to bob. So here's the flow:

sudo mv ~bob/Documents ~bob/Documents.orig
sudo mv ~alice/Documents/ ~bob/Documents
sudo chown -PR bob ~bob/Documents


In case you want to overwrite the group as well, use

sudo chown -PR bob:bob ~bob/Documents


sudo chown -PR bob: ~bob/Documents

to use bob's primary group.

However, beware that this could be problematic in case ~alice/Documents had non-default group permissions. In that case it might be better to use something like

sudo find ~bob/Documents -group alice -exec chown -h bob: {} +

If ACLs are in use, you may want to check those as well.


As Bob:

mv ~bob/Documents ~bob/Documents.orig
cp --remove-destination --no-preserve=ownership -r ~alice/Documents/ ~bob/
sudo rm -fr ~alice/Documents/
  • I accepted the other answer, but this looks good too. I voted it and other answers posted by you. :-) Thanks! – Ionică Bizău Jan 18 '15 at 19:41
  • @Costas: Is there an advantage of using cp vs mv ? The latter only adjust pointers to the filesystem and is much faster if both home folders are on the same filesystem. Or did I miss something ? – Karolos Jan 18 '15 at 20:50
  • @Karolos Yes, you are right. But the main advantage of cp have much more options. Thus if we told about files on same filesystem you can use option -l(--link) to make just hard-links instead of copying. – Costas Jan 18 '15 at 21:06
  • @Costas I see; good point about the options, and -l is a good option to provide indeed. – Karolos Jan 18 '15 at 21:08
  • @Karolos Another point would be that I probably want to delete Alice's documents after one week. :-) So, I used cp instead of mv. – Ionică Bizău Jan 19 '15 at 5:43
cp -avv /home/alice/Documents/ /home/bob/newDocuments/ && 
  chown -Rvv bob:bob /home/bob/newDocuments/
  • +1 for considering the group as well (:bob) – sourcejedi Jan 18 '15 at 20:45

If bob has no permission to read alice's home folder you should do some operations as super user (if Bob has no already that power) I personally will use something like this:

sudo rsync -a --progress /home/alice/Documents/ /home/bob/Documents/
sudo chown -Rv bob:bob_group /home/bob/Documents
sudo rm -rv /home/alice/Documents
  • rsync is very versatile you may chose what files you want to skip or sync an already existing folder or copy from a remote host and more other options. I this example "-a" stands for archive. It implies more rsync options like -r and -p which stands for recursive and preserve permission. It include also -o (preserve owner) and -g (preserve group) and you can tweak this options as you prefer. So at the end of execution of this command you will have a clone an Alice's Documents folder in Bob's home folder.

  • chown will change owner and owner group of new folder

  • rm, will remove original folder if you want that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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