{ 1 trackback }

HackITLinux
01.31.07 at 11:01 am

{ 48 comments… read them below or add one }

1 podee 12.21.06 at 4:00 am

Hi

I followed your instuction on CentOS 4.4. When I reboot I lost my root user and gdm din’t start.
I could login from all user but not root.
Can you help to give me some advices please?

Pordee

2 nixcraft 12.21.06 at 7:59 am

You made mistake somewhere. But don’t worry you can login into single user mode (rescue mode) and reset root account password.

http://www.cyberciti.biz/faq/linux-reset-forgotten-root-password/

3 ssdon 01.02.07 at 10:25 pm

Great! The following line is probably a typo as I’m assuming you mean to back this up with a copy, otherwise you nuke the password files (probably what happened to nixcraft)

# mv /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak

# cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak

4 nixcraft 01.03.07 at 1:50 am

ssdon,

Typo has been fixed.

Appreciate your feedback.

5 Tom 01.03.07 at 2:17 am

There is an error in the article. In the step where you back up the passwd, group, shadow, and gshadow files from the new system to the newuser.bak directory, use the cp command, not mv.

In other words, the article should read:

“Commands to type on new Linux system

First, make a backup of current users and passwords:
# mkdir /root/newsusers.bak
# cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak”

6 Bud 01.15.07 at 5:50 pm

Your instructions worked perfectly when migrating accounts from Redhat 4ES to another Redhat 4ES. I added a couple of steps to move all the aliases and aliase folders to the new server. Thanks

7 Oduor Sam 01.21.07 at 8:09 pm

Thanks,
I am looking for a payrise after rescuing a dying server. It has worked for me perfectly.

8 Rick 01.31.07 at 3:34 am

It may sound complicated, however, I am much more happy to do this with Linux than with Mickey$oft O/S’s, in fact, I am much more happy to do ANYTHING with Linux over Windoze!

9 _ranger_ 01.31.07 at 12:38 pm

If you had used LDAP for user accounts, then you wouldn’t have needed to migrate user accounts ….

Also, you could skip the whole tar aspect by just using rsync, e.g. rsync -e ssh -avtP /home/ newserver:/home

10 Charles Witt 01.31.07 at 2:55 pm

Thanks for the howto. This is really close to what I have been looking for. In my particular situation LDAP and NIS do not fit as well as your howto does. Also thanks for the comments of everyone, as they are helpful.

11 exi 02.05.07 at 1:14 pm

you might wanne consider runing sshfs on your new server, then u can login to the old (if sshd is running) and simply copy the requierd data true fx. mc, and get all the file rights w you…
its fast is simpel, and you only need to have secure shell intstalled on the old box`s to make it work… (and most boxses have… ;)

just a littet advice for the data moving part.

12 Phil 02.09.07 at 7:45 am

I have a problem, for starters, it look lie I was kind of doing the right thing myself but this blog really helps, thanks. Anyway everything works fine untill I get to the bit where I am extraction all the users data from the home.tar.gz. (kind of important bit) and it fails with text flying up the screen saying “Cannot change ownership to uid 511, gid 511″ and “Cannot mkdir: Permission denied” and ” Cannot open: Permission denied”

obviously I do not have permissions :o(

I am loged in as root and the home directory of the new server has these permissions:

drwxrwxrwx 12 root root 0 Feb 8 19:28 home

I’m not sure how it is possible to obtaim more permissions than that. I have tried with other privilages on the home directory and it still does it.

PLease can someone help me

Many thanks
Phil

13 GT4NE1 02.14.07 at 6:06 pm

Don’t forget about migrating cron jobs.

/var/spool/cron

Anything else we haven’t thought of?

14 aleksb 04.17.07 at 9:45 am

Hi!

I tried your howto, and everything went along great until i rebooted and tried to log on with the users i just copied over. root works fine. The passwords are not accepted, and i cannot change them with passwd. “passwd: Authentication token manipulation error”. Im using fedora core 6.

Please help
Aleks

15 aleksb 04.17.07 at 9:58 am

Nevermind, figured it out :)

Were missing a statement in the shadow file copy thingamabob

16 vikrant v mankar 04.24.07 at 1:23 pm

hi i am new user in linux i am getting every answer from ur site.you are providing great solution on every problem its being great to refer your site thanks for every thing

17 Subhanjan 07.19.07 at 7:07 am

Hi,
I have a small query my new system already has couple of user accounts now I want to transfer the user accounts from the old system I have checked both the systems there is no conflicts in UID,GID so shall I go ahead with it.

Subhanjan

18 Subhanjan 07.19.07 at 12:38 pm

Hi,
The things worked beautifully for me.
Thanks to the author.One more thing cant I script the steps that are done by the command awk?

Subhanjan

19 NewLinuxUser 08.23.07 at 6:13 pm

I was able to migrate the home folders and accounts from RedHad Linx to Fedora but it seems that I cannot log in with the migrated accounts although I am able to see them under USERS. Am I missing anything? Please help.

20 Prashantshant 08.27.07 at 8:02 am

I am very much thankful that I got migration solution of user. How to transfer printer settings of each user from one m/c to another? we have localy connected the printers to thin clients.

21 Paul Douglas Franklin 09.19.07 at 6:30 pm

Thank you so much. This is beautiful. I’m trying to upgrade to a new physical box, different distro, switch to ldap, and from Samba 2 to Samba 3. All this without messing up the working server. I’ve messed up the new box several times, and your migration page is very helpful in avoiding mistakes during this stage. BTW, I used rsync instead of tar for the home directories.

22 asaguru 10.10.07 at 10:40 am

now i am using centos 3 in a dell server now in that server i am running sendmail squid and iptables ftp now i want to migrate the server in to new dell server running in centos 5

please any one help me on this issue

23 RaM 10.30.07 at 8:51 am

hi
everyone i have question im a newbie admin can anyone give me advise or help me if how can i backup my old linux email server III to new one or migrate to cent mail..tnx what are the important files to back up for linux suse email server III?

24 Eliena Andrews 11.27.07 at 10:12 am

hii,
i followed the procedure above, after all steps. USers password is not getting accepted, what could have went wrong ?

Eliena Andrews

25 Kevin Smith 12.24.07 at 10:28 pm

I cut and pasted the commands into an SSH terminal & checked the passwd.mig and shodow.mig to find they were empty!
I double checked the lines and they were correct (values ect.)
Plus I end up with a file called “-” which I’m guessing comes from the “/etc/shadow” line “tee -” (typo maybe?)
Id really like to get this working as it would be quite helpful with my project. My Level is slightly above newbie Admin.

Kev

26 mj40 02.06.08 at 1:51 am

First of all i just wanna say thank you guys! This is my first time to get into the linux world! ….

I follow the instruction regarding how to’s .. then after rebooting my new centos5 box error message appears:

“The user database cannot be read. The problem is most likely caused by a mismatch between /etc/passwd and /etc/shadow or /etc/group and /etc/shadow. The program will exit now.”

I follow the instructions twice and i got same message error. I dont know how to fix this one. Please help me…

Thanks.

27 Augusto 02.19.08 at 8:34 pm

this how to works great :) But now Im stuck i need to migrate from Redhat to Debian the UGIDLIMIT are different on this distros? any advice ?
thanks

28 Betty Harvey 06.17.08 at 12:27 pm

Great instructions easy to follow!!! Worked like a charm!! Thanks for making this available – I
have it bookmarked for when I do this again!

29 Peter Thomson 06.18.08 at 1:49 am

RE: Augusto need to migrate from Redhat to Debian the UGIDLIMIT are different on this distros
this advice would be useful for me too. Is it possible to adjust the /etc/passwd and /etc/group files?

30 Brett Knights 06.26.08 at 5:38 pm

Thanks, This was very useful.
I needed to move a couple of system accounts

so did this:
awk -F: '($1 ~ /(tomcat|apache)/)' /etc/passwd > /root/move/passwd.mig
awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /etc/passwd >> /root/move/passwd.mig

and then couldn’t figure out what the tee gave me and I was moving a set of users not based on UID so did this:
awk -F: '{print $1}' /root/move/passwd.mig |egrep -f - /etc/shadow > /root/move/shadow.mig

HTH

31 Debbie 08.08.08 at 8:14 pm

Fabulous! Routine worked great! Thanks for posting it, saved me a ton of time.

32 Bryan 08.26.08 at 4:34 pm

Also – a couple of commands to check out if you are having problems with “User database cannot be read” error: pwconv, grpconv and pwck. Works like a charm – now… :)

33 Miro 10.16.08 at 6:16 pm

OK, I followed instructions… got stuck with users not being able to log in. If instructions were not correct, how do I fix it now?

34 Alan 11.07.08 at 11:30 am

Excellent! I followed the instructions and did a fresh install of openSuse 11.0 on to 10.3. I have my old /home on a separate partition and didn’t mount it during install because Suse wants an initial user which would have overwritten my original first user (UsId=1000). I installed, logged in as root, deleted the initial user, changed the mount of /home to point to my old /home partition, did the transfer of backed up passwd files etcetera, rebooted and bingo!

My only worry was, when it came to generating the initial user during install, I had a choice of encryption algorithms for the password. Obviously if I’d chosen the wrong one I’d be stuck (though I could probably log in as root and reset the users’ passwords).

So my question is: is it possible to tell what encryption algorithm was used for password storage before starting?

Thanks again for the info.

Alan.

35 Dominic 11.26.08 at 10:39 am

I am wanting to mirror users/groups to from one Ubuntu server to another. I see that Ubuntu starts off with a user with UID 1000 (created with the name you give it in setup), I guess I should not try to migrate this user since it already exists on the destination machine i.e. I should set UGIDLIMIT=1001?

What if one re-runs this action later to update the mirror? Do users gets duplicated cos surely one gets multiple entries for same user in /etc/passwd?

36 Mike 12.17.08 at 2:31 am

Great Doc. I was able to migrate a CentOS system to a VM.

37 Ganymede 01.09.09 at 9:09 pm

My $0.02: For those who are concerned about UID’s and GID’s…

…you can change UID’s and GID’s on the old system before migration using:

groupmod -g (newgid) groupname
usermod -g (newgid) username OR usermod -G (newgid) username
(’g’ changes the initial group or ‘G’ to add an additional group membership)

Make a backup of the old files first and then change the group GID then change any appropriate users attached to those groups if necessary. Test to make sure all is well. You can do this preemptively if you are going to from a system that starts custom groups at 500 to one that starts custom groups at 1000 or if you don’t want any UID/GID conflicts with your target system. Be the superuser and it would also be prudent to make the changes while none of the users are attached.

Feel free to pick this post apart.

38 KPryor 01.10.09 at 10:41 pm

Very very helpful. I’m going to be needing to do this soon and didn’t really know how to proceed. Thanks!
KP

39 Joe Riley 02.05.09 at 8:19 am

Your FAQ fails to copy over ‘/etc/passwd-’ as well

in the command:
cp /etc/passwd /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak

should be:

cp /etc/passwd /etc/passwd- /etc/shadow /etc/group /etc/gshadow /root/newsusers.bak

40 Shawn 02.17.09 at 4:16 pm

Fantastic instructions. A+++

Thanks.

41 gczman 03.02.09 at 3:35 pm

copied the mbox’s from one unix box and the /etc/passwd and /etc/shadow and it worked perfectly. thanks

42 waloyce 03.24.09 at 4:26 am

Thanks the howto is very useful.But how to migrate the virtual users and domains accounts to a new server

43 Denis 03.30.09 at 5:07 am

Great instructions, worked well for me
BTW, if I had 2 linux servers, do you think it would be possible to merge the accounts into one of the 2 ?

44 roshan 04.06.09 at 10:30 am

your cp & awk command is so good

45 fidel 04.23.09 at 10:44 am

thanks for this small & easy how-to

Worked like a charme

46 Juan Carlos 06.15.09 at 2:30 pm

there is something similiar for Solaris ?

47 Vivek Gite 06.15.09 at 2:49 pm

@Juan,

Solaris uses the same files /etc/passwd and friends. So it should work with a little modification.

48 mstone 06.16.09 at 5:24 pm

Also check for aliases because a common multiple recipients solution uses that technique

Leave a Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Tagged as: , , , , , , , , , ,

Previous post: Create a mysql database, tables and insert data

Next post: How to test or check reverse DNS