Using backed up "Home" dir for user "Home" dir in another Computer
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Using backed up "Home" dir for user "Home" dir in another Computer
Hi,
Using Ubuntu 22.04.1 on two different machines.
I have a backed up 'home' dir from computer 'A' - say 'homeA.bak'.
I have another computer 'B' which already has a 'home' dir for the principle user as set up upon installation , call him 'usrB'.
Now I want to create a new user 'usrB-2' without a 'home' dir and then create a 'home' dir for 'usrB2' which will be 'homeA.bak'.
I assume from what I read that 'home' directories are not like 'regular' directories' in that they contain other files in them that make them 'home' directories. ie: you just can't make a directory called 'home' and copy backed up files to it and have it act like a 'home' directory.
Can someone tell me how to do this properly? Thanks in advance,
R
Yes a home directory contains a bunch of configuration files and other stuff in hidden files and directories but that can also be backed up. If user b has the same uid,gid then restoring via a file is doable otherwise rsync should work.
It is also quite possible to create the second user with their own directory.
Then restore the content of the backup to the new home directory. Note that you would want to restore the content and not the full directory plus content so you avoid unwanted nesting of directories.
Once that is done then the only thing that should be required would be to use chown to ensure the restored content is properly owned by the second user.
Another possibility would be to restore the backup into /home (full, including users home directory [making sure there is no name conflict with already existing home directories]). Once restored you could remove the users home directory, then rename the restored home directory to the directory name that was created for your new user. Again the final step would be using chown to restore ownership to the new user.
Example - the backup was for user john on machine A.
The second newly created user on machine B is Jack.
Restore the backup into /home on machine B which would create the directory tree /home/john.
Delete the directory tree /home/jack so that directory name does not exist.
Rename /home/john to /home/jack
chown -R jack:jack /home/jack
Your new user jack now has the entire directory tree that originally belonged to john on machine A.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.