rsync - syncronising two directories passwordless

rsync - syncronising two directories passwordless

Postby MrTempleDene » Jul 15th, '14, 12:54

My problem is I have two computers, I edit my php source on both of them and want some way to set up both machines to quietly, in the background, make sure the two source directories keep in sync whenever both machines are on my local network.

I've been reading about rsyncd, unison and various other solutions until my head hurts with no real progress

Both machines run Mageia the laptop is on 4 and the PC is on 3 (and needs updating I know)

I don't want to have to do anything more than just boot up both machines.

I just get the feeling I have missed something obvious. Do feel free to tell me how stupid I am.
Last edited by doktor5000 on Jul 15th, '14, 19:54, edited 1 time in total.
Reason: adjusted thread title
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20

Re: synchronishing two directories

Postby MrTempleDene » Jul 15th, '14, 15:19

Well I have now got this far

rsync -h --progress --stats -r -tgo -p -l -D --update --protect-args /home/pete/Documents/rsynctest/ pete@192.168.1.202:/home/pete/Documents/rsynctest/

And I can run that as a cron job, but it asks for a password every time, working on that now.
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20

Re: synchronishing two directories

Postby napcok » Jul 15th, '14, 15:24

I think you can just configure NFS for that. http://nfs.sourceforge.net/nfs-howto/ar ... whatis_nfs
napcok
 
Posts: 19
Joined: Aug 15th, '11, 13:39
Location: Poland, Dąbrowa Górnicza

Re: synchronishing two directories

Postby Lebarhon » Jul 15th, '14, 16:39

Hi,
Did you try LuckyBackup? It is in the Mageia depositories.
http://luckybackup.sourceforge.net/features.html
Lebarhon
 
Posts: 408
Joined: Mar 22nd, '11, 22:24
Location: France

Re: synchronishing two directories

Postby MrTempleDene » Jul 15th, '14, 16:49

Thank you napcok, of course then the mounted directory just appears local, now why didn't I think of that. See I told you I could be called an idiot.
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20

Re: synchronishing two directories

Postby isadora » Jul 15th, '14, 16:51

Please don't forget to mark the topic [SOLVED].
You can do so, by editing the subject/title in the first message in this topic.
Write [SOLVED] to the left of subject/title, thanks ahead. ;)
..........bird from paradise..........

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away.
—Antoine de Saint-Exupéry
User avatar
isadora
 
Posts: 2763
Joined: Mar 25th, '11, 16:03
Location: Netherlands

Re: synchronishing two directories

Postby MrTempleDene » Jul 15th, '14, 16:52

Lebarhon, Thanks for your suggestion, it was LuckyBackup that gave me help with the synatx for rsync.

My quest though would be for it to be totally automatic, I'm not totally happy about running a cron job for this really, but it will do for now.
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20

Re: synchronishing two directories

Postby doktor5000 » Jul 15th, '14, 19:53

MrTempleDene wrote:rsync -h --progress --stats -r -tgo -p -l -D --update --protect-args /home/pete/Documents/rsynctest/ pete@192.168.1.202:/home/pete/Documents/rsynctest/


Why all those flags? Are you really sure you need each of those? Just asking ...
Usually rsync -avz is totally sufficient. Add --progress if you want verbose progress output, and --dry-run if you only want to see what rsync would do, but don't change anything.

MrTempleDene wrote:And I can run that as a cron job, but it asks for a password every time, working on that now.

You want to enable key-based ssh authentication, that is pretty easy. Then instruct rsync to use ssh as transport and you're done.

What you want to do (if you want to enable passwordless login for the root user, more steps may be required)
Code: Select all
ssh-keygen -t rsa -b 2048
enter
enter
enter
ssh-copy-id user@targetmachine

ssh user@targetmachine


The last ssh command should not ask for password. This is the most simple scenario. There are plenty of howtos for that:
http://www.debian-administration.org/ar ... th_OpenSSH
http://askubuntu.com/questions/46930/ho ... -ssh-login
http://www.thegeekstuff.com/2008/11/3-s ... h-copy-id/
http://www.linuxproblem.org/art_9.html

Then use the option -e ssh for your rsync command. For more help and rsnyc examples check e.g.
https://wiki.archlinux.org/index.php/rsync
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18020
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: rsync - syncronising two directories passwordless

Postby MrTempleDene » Jul 16th, '14, 01:14

It was luckybackup suggested all those, I have to admit to being in a hurry at that point so stuck with what worked.

But will azh sync both directories bidirectionally? I am not looking to just copy the files to a backup directory, I have two "live" directories and need them to sync "automagically" in both directions whenever the two computers are on the same network.
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20

Re: rsync - syncronising two directories passwordless

Postby MrTempleDene » Jul 16th, '14, 01:16

And thanks for the ssh information, I will try that tomorrow.
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20

Re: synchronishing two directories

Postby MrTempleDene » Jul 16th, '14, 01:18

isadora wrote:Please don't forget to mark the topic [SOLVED].
You can do so, by editing the subject/title in the first message in this topic.
Write [SOLVED] to the left of subject/title, thanks ahead. ;)


Don't worry, I will once it's all working and I can do a quick write up in case it is useful for anyone else. This may be basic stuff for some of you but it's all new to me.
OS: Mageia 9 - KERNEL: 6.4.9-desktop-4.mga9
MB: GA-78LMT-USB3
CPU: AMD FX-6300 Six-Core
GPU: NVIDIA GeForce GTX 750 Ti - GPU DRIVER: NVIDIA 535.86.05
MrTempleDene
 
Posts: 44
Joined: Oct 14th, '12, 15:20


Return to Networking

Who is online

Users browsing this forum: No registered users and 1 guest