Atentie! Tutorial kilometric!

Problema initiala: Mutat serviciul de mail de pe un server vechi pe cel nou. Configuratia era Postfix + useri reali (nu s-a folosit sql pentru stocarea userilor si a datelor).

Cu ajutorul celor de pe #postfix (freenode) am reusit sa imi rezolv problema astfel:

- Oprit postfix si Apache (aveam Squirrelmail)
# postfix stop
# apache2ctl stop

- Montat hardul vechi in /mnt
# mount /dev/hda1 /mnt

- Creat directorul /root/move, unde vor sta fisierele cu care lucrez
# mkdir ~/move; cd ~/move

- Setat UGIDLIMIT la 1000, pentru ca sistemul e Debian (500 pentru Fedora/RH)
# export UGIDLIMIT=1000

- Copiat toti userii vechi din configuratia veche (toti cu UID >=1000). Pe sistemul nou nu existau alti useri in afara de cei creati la instalare. # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /mnt/etc/passwd > /root/move/passwd.mig # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534)' /mnt/etc/group > /root/move/group.mig # awk -v LIMIT=$UGIDLIMIT -F: '($3>=LIMIT) && ($3!=65534) {print $1}' /mnt/etc/passwd | tee - |egrep -f - /mnt/etc/shadow > /root/move/shadow.mig

- Copiat userii creati de sistem pe configuratia noua (UID < 1000) in alt fisier # awk -v LIMIT=$UGIDLIMIT -F: '($3<LIMIT)' /etc/passwd > /root/move/passwd.new
# awk -v LIMIT=$UGIDLIMIT -F: '($3<LIMIT)' /etc/group > /root/move/group.new
# awk -v LIMIT=$UGIDLIMIT -F: '($3<LIMIT) {print $1}' /etc/passwd | tee - |egrep -f - /etc/shadow > /root/move/shadow.new

- Unite toate fisierele de mai sus
# cat /root/move/passwd.mig >> /root/move/passwd.new
# cat /root/move/shadow.mig >> /root/move/shadow.new
# cat /root/move/group.mig >> /root/move/group.new

- Copiat gshadow din configuratia veche, just in case
# cp /mnt/etc/gshadow /root/move/gshadow.mig

- Backup la fisierele de useri/grupuri de pe serverul nou
# cp /etc/passwd /root/move/passwd.bak
# cp /etc/shadow /root/move/shadow.bak
# cp /etc/group /root/move/group.bak
# cp /etc/gshadow /root/move/gshadow.bak

- Suprascris fisierele din configuratia noua cu cele cocatenate mai sus cu cat
# cp /root/move/passwd.new /etc/passwd
# cp /root/move/shadow.new /etc/shadow
# cp /root/move/group.new /etc/group
# cp /root/move/gshadow.mig /etc/gshadow

- Copiat directoarele home si mail
# cp -Rpv /mnt/home /
# cp -Rpv /mnt/var/mail /var/

- Copiat configuratia postfix
# cp -Rpv /mnt/etc/postfix /etc/

- Copiat Squirrelmail
# cp -Rpv /mnt/etc/squirrelmail /etc/


Reboot pentru siguranta (sa isi vada sistemul toti userii, dar nu e obligatoriu). Postfix porneste automat, impreuna cu Apache.

Sper ca am scris bine toate comenzile :) O buna parte sunt din memorie. Mai ales la cele de la sfarsit, cu cp -Rpv nu sunt sigur.

Va rog sa ma corectati unde am gresit.

Sebastian Scarlat

_______________________________________________
RLUG mailing list
[email protected]
http://lists.lug.ro/mailman/listinfo/rlug

Raspunde prin e-mail lui