LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Importing user accounts/passwords from another linux machine (https://www.linuxquestions.org/questions/linux-newbie-8/importing-user-accounts-passwords-from-another-linux-machine-813447/)

ganesh_k 06-10-2010 06:11 PM

Importing user accounts/passwords from another linux machine
 
I have couple of users in one machine. I can access the /etc/passwd,/etc/shadow and /etc/group files in this box. I have another box. I want to create some user accounts in the second box by just looking in the passwd, shadow and group files in the first box. I would just copy over the corresponding lines into the corresponding for whichever accounts I want to create as new and also change the lines for which I want to update the account information. Is this possible and will also the passwords work fine? Please also let me know there is any good tool for automatically doing this kind of stuff. Both the boxes that I have are Ubuntu machines though one is running Ubuntu 8.04 and the other is 10.04. Thanks in advance!

Thanks,
Ganesh

TB0ne 06-10-2010 06:14 PM

Quote:

Originally Posted by ganesh_k (Post 3999527)
I have couple of users in one machine. I can access the /etc/passwd,/etc/shadow and /etc/group files in this box. I have another box. I want to create some user accounts in the second box by just looking in the passwd, shadow and group files in the first box. I would just copy over the corresponding lines into the corresponding for whichever accounts I want to create as new and also change the lines for which I want to update the account information. Is this possible and will also the passwords work fine? Please also let me know there is any good tool for automatically doing this kind of stuff. Both the boxes that I have are Ubuntu machines though one is running Ubuntu 8.04 and the other is 10.04. Thanks in advance!

Thanks,
Ganesh

Possible? Yes. A good idea? No.

Create a script to add the missing users/groups on the new box, and be done with it. And that's only really a good idea, if you've got LOTS (like over 100) users to add. Otherwise, it's a waste of time. The groupadd and useradd commands are not hard to use.

ganesh_k 06-10-2010 06:29 PM

Thanks for the reply TBOne. But I would also want to create the users in the second box with the exact passwords as in the first one and I don't know the passwords. So I don't think I can do this manually using the useradd or groupadd commands. Am I right?

jlinkels 06-10-2010 07:57 PM

Install a NIS server.

jlinkels

ganesh_k 06-11-2010 12:54 AM

NIS server
 
Quote:

Originally Posted by jlinkels (Post 3999611)
Install a NIS server.

jlinkels

Thanks very much jlinkels! I didn't know about NIS. Nice to hear about it now. I will see if I can use it.

TB0ne 06-11-2010 08:11 AM

Quote:

Originally Posted by ganesh_k (Post 3999545)
Thanks for the reply TBOne. But I would also want to create the users in the second box with the exact passwords as in the first one and I don't know the passwords. So I don't think I can do this manually using the useradd or groupadd commands. Am I right?

NIS (or LDAP) are options.

And you CAN specify a password on the command line. Read the man page for the useradd command, pay attention to the -p option. Changing the default method of authentication to migrate from one system to a new one, is alot of work. Again, you don't say how many users, but if it's just a few, tell them to pick new passwords. Set everyone a default password, and tell them to use it the first time. After login, it'll prompt them to change it. Problem solved.


All times are GMT -5. The time now is 01:40 PM.