0

I want to move to a new server and automate the process of moving the contents of Maildir/ keeping it synchronized up to the switch-over point by utilizing a cron job. I don't want to enable root login nor do I want to enable login for the LDA username, postalworker. The server is CentOS 5 running postfix/dovecot.

What is the best way to handle this? I already have public/private key ssh working for another username but how do I get around logging in as postalworker directly? The contents of Maildir/ are all owned by postalworker and seem to all have 0600 permissions. Thus, using group permissions would require resetting all the permissions. There must be an easier way that I'm missing. Any help is appreciated.

Levon
  • 138,105
  • 33
  • 200
  • 191
Studio XYZ
  • 11
  • 1
  • 3

1 Answers1

1

You could use rsync on the source server running as root

run as root on source

 rsync -avz -e ssh --delete /stuff/ user@desktop ip:/home/laptop/stuff/

If the destination user doesn't have the correct privileges could then run a rync cron as root then sync the directories

So it would look like this at source

*/2 * * * * root rsync -avz -e ssh --delete /stuff/ user@desktop ip:/home/laptop/stuff/

Then

*/10 * * * * root rsync -avz --delete /home/laptop/stuff /Maildir/
Paperghost
  • 96
  • 9
  • Ah, so if I understand you correctly, the contents of `Maildir/` get placed in a holding directory on the destination server. Then another process running as root on the destination server completes the move locally. This effectively circumvents logging in to either server as root. Nice idea! – Studio XYZ Jun 18 '12 at 02:00
  • correct this allow , you could also make a new user and set its home directory as /maildir/ which would then give them write access just to that folder which would prevent having to have two step down to one. Both ways will work – Paperghost Jun 18 '12 at 09:30