1

Is there a way to merge two users, and combine all the documents? I have two users, and the permissions are getting screwy, as I guess sometimes I action items with different accounts somehow.

1
  • I guess there isn't an easy way to "merge accounts" because there's always the possibility of duplicate filenames. There's no reliable way to resolve such conflict, unless you are ok with using the date/time on the file (i.e., more recent file wins). You can use a file synchronization tool such as unison or the graphical front-end unison-gtk, but when a conflict occurs, it will prompt the user for a resolution. I believe both sit on top of rsync.
    – Ray
    Dec 17, 2018 at 3:24

2 Answers 2

2

Let's say you have userA and userB and we want to only have userA:

First, make sure userA owns everything:

sudo chown -R userA:userA /home/userB
sudo chown -R userA:userA /home/userA

Now userA owns everything in both home folders, you can move the files how you choose. If we use the file browser to go to /home/userB and select all the folders/files and cut (ctrl+x) then navigate to /home/userA and paste (ctrl+v).

Files will ask what to do with duplicates, select merge for the folders, and skip or replace the duplicates. If you want to keep config files too, you will need to hit ctrl+h to show hidden files and then copy/move those to userA home folder.

Once you are satisfied that all files are moved, you can delete userb:

sudo userdel userB
sudo rm -rf /home/userB

And that should be about it!

2

This answer should solve the problem, assuming one or both of the users has sudo privileges source

sudo cp /home/USER1/FNAME /home/USER2/FNAME && sudo chown USER2:USER2 /home/USER2/FNAME

Will copy the file from USER1 to USER2, and then change the owner of the copy in /home/USER2 to USER2

If you do not have sudo privileges, then the two users will need to ensure that you have read permissions on the USER1 directory, and write access on the USER2 directory. If you have these accesses, you can enter the command:

cp /home/USER1/FNAME /home/USER2/FNAME

This will copy the file in question, but USER2 may not be able to manipulate the file until they have appropriate permissions

In your particular case, you would likely need to sudo cp -R /home/USER2/* rather than just copying file by file.

Not flagging as a duplicate, as it's not technically the same question. If that doesn't matter, and it should be marked as a duplicate, someone with a higher rep score, please flag

3
  • That sounds pretty straightforward... I'll give it a shot when I get home. Thanks!
    – LexITSol
    Dec 17, 2018 at 14:15
  • 1
    welcome to askUbuntu! when answering questions, it is best to post an actual answer and not just a link (in case link goes down)... unless of course you are flagging a dupe... thanks! Dec 17, 2018 at 14:21
  • @JoshuaBesneatte Done. Thanks for the heads up. Dec 17, 2018 at 19:55

You must log in to answer this question.

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