[CentOS] migrating users from linux to centos
José Albornoz
jalbornoz at viabcp.com
Tue Jul 24 18:54:08 UTC 2007
Hi all
First copy /etc/passwd and /etc/shadow to /tmp of new server
Second go to /tmp of new server
Third, run this script "sh users.sh"
awk -F: '$3>500 {print $1":"$4":"$5":"$6":"$7}' passwd > archivo1
for u in $(cat archivo1 | cut -f 1 -d:);
do
GROUP1=$(egrep $u: -a archivo1 | cut -f 2 -d:)
CMT1=$(egrep $u: -a archivo1 | cut -f 3 -d:)
HOME1=$(egrep $u: -a archivo1 | cut -f 4 -d:)
SHELL1=$(egrep $u: -a archivo1 | cut -f 5 -d:)
useradd -g $GROUP1 -c "$CMT1" -d $HOME1 -s $SHELL1 $u
PASSWD=$(egrep $u: -a shadow | cut -f 2 -d:)
usermod -p $PASSWD $u
done
rm -f archivo1
Jose Albornoz
-----Mensaje original-----
De: centos-bounces at centos.org [mailto:centos-bounces at centos.org] En nombre
de Barry L. Kline
Enviado el: Martes, 24 de Julio de 2007 1:47 p.m.
Para: CentOS mailing list
Asunto: Re: [CentOS] migrating users from linux to centos
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
simon wrote:
> Dear All,
>
> I have been running linux 9 server as a dns and mail server and is
> workin fine..
>
> i want to install CENTOS 5 with all the latest mail server software
> and bind as well as all the libraries on another machine whic is
> already done
>
> also the data is backed up and will be tranferred.
>
>
> but i would like to know
>
> i have about existing 100 mail users
>
> how could i tranfer these usernames and passwrd to the new CENtos 5 server
..
>
> if i copy the /etc/passwd from my linux server it gonna overite my
> centos5 /etc/passwd file as there r new users n also new groups create
> when i installed centos5 n software also i see that the /etc/shadow
> has only read permisson for root so cant be over written
>
> is there a way i cd possiblly have the existing users with thier
> password on centos5 so i dont have to ask them for their passwords n
> create all users again
>
Create copies of /etc/{passwd,shadow,group} from the original system.
Edit the copies to EXCLUDE existing user/groups.
Append the remaining entries to the existing file.
e.g.:
cp /etc/passwd /etc/passwd.old # from the old system
vim passwd.old (and edit out the existing entries)
copy passwd.old to the new system
cat passwd.old >> /etc/passwd (notice the '>>')
Repeat for group & shadow.
Barry
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
iD8DBQFGpkkLCFu3bIiwtTARAmBqAJ9vr7WLzUbHsTVlfjQOHNgkxY5o8QCgm7UE
gwploWjfp54KlMQ1OF7rkYQ=
=NMBd
-----END PGP SIGNATURE-----
_______________________________________________
CentOS mailing list
CentOS at centos.org
http://lists.centos.org/mailman/listinfo/centos
More information about the CentOS
mailing list