Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cron job, init.d and ppp start, where and when ?
Message
General information
Forum:
Linux
Category:
Networking, Installation and Administration issues
Miscellaneous
Thread ID:
00442396
Message ID:
00446974
Views:
16
>Is it possible to create a script which, when run, would read the user table...

Well, this answer is going to be different depending on which password database you want to replicate. For instance, if you want to replicate the system passwd/group file, it will be different than if you want to replicate MySQL permissions.

> ...and generate a second script which, if run on a new installation, would create those accounts on that installation?
>I see the essence of if using 'useradd' but I'm not sure which files contain that info. Passwords are encrypted in passwd so I'd have to have run it through a decryption algorithm (?)... ?????

You don't need to use useradd if you already have a password/group file. You are most likely using shadow passwords and groups. The tools you need are:

pwconv, pwunconv, grpconv, grpunconv

These tools are used to encrypt and decrypt shadow passwords. So you can read a password file, decrypt it, remove the system entries (root, bin, daemon... etc), and then boom. You can transfer and recrypt. You could even write the script generator to embed the password file so that everything is self contained.
You could store everything encrypted if you preserve the original passwd, shadow, group, and gshadow, but if someone has those, they can decrypt it with pwunconv and grpunconv, so it's up to you how you do it.

j
Jason Bradley Nance
jbnance@tresgeek.net

Got root?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform