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.
I bought a new server and would like to transfer all data (around 30GB) from the old to the new server. I guess that is a pretty classical job and I'm not quite sure how to do it. How is it the typical way to handle such a case: transfer files with permissions and ownerships, and transfering the users from the old to the new server.
Should I use scp, mount, ssh & tar?
I started with scp but I lose then the ownerships. But If I want to keep the ownerships, then all the users have to be registered in the new server, but then if i just past users an groups from the old to the new, I'm afraid that some group_Id or anything might not be working beacause there are already users in the new server.
I hope that I'm not being too confusing and would appreciate to learn what is the clean way to handle this case.
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940
Rep:
rsync (over ssh) unison (over ssh) or tar archives do the job. unison is actually a file syncronizer, but can be handy for such a single use. you might have to edit /etc/passwd and /etc/group and /etc/shadow manually, so you dont overwrite any system user data. use the programs vipw (for /etc/passwd) and vigp (for /etc/group). a simple copy and past of the user data is ok here. read the man pages for rsync, unison or tar, depending on what you want to use, so you can see which parameters you need for keeping ownership and permissions (you might want to use numerical ownership if you transfere the data before creating the users)
use the programs vipw (for /etc/passwd) and vigp (for /etc/group). a simple copy and past of the user data is ok here. read the man pages for rsync, unison or tar, depending on what you want to use, so you can see which parameters you need for keeping ownership and permissions
Will then shadow be automatically updated?
Quote:
Originally Posted by Nathanael
(you might want to use numerical ownership if you transfere the data before creating the users)
Distribution: debian, gentoo, os x (darwin), ubuntu
Posts: 940
Rep:
1. no, shadow is not automatically updated, you have to do this using vim again. i have not seen a tool like vipw or vigp to edit the shadow file. but a simple copy and paste should do the trick. please dont forget to only transfere the entries corresponding to actual users and not system users (you can destinguish between users and sys-users by the login program specified, eg. /bin/bash or /bin/false, sys-users will have something that is not a shell:/bin/false)
2. have a look at the man page for whatever program you choose to use. tar for example will use the parameters --preserve and --numeric-owner. you should generally read the man page if you are not familiar with a programm.
In the first server I have in group:
sysadmin::14:bob,Dave
and in the 2nd I only have
" sysadmin:: "
without any user. May I just add manually bob and Dave in the file "group" of the second server?
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.