View previous topic :: View next topic |
Author |
Message |
ad_meis Tux's lil' helper
Joined: 17 Feb 2006 Posts: 120 Location: Tuscany, Italy
|
Posted: Tue Jul 31, 2012 4:58 pm Post subject: using unison on server to sync with machine inside a network |
|
|
Dear Gentoo Forums,
I have the following issue. I have a laptop that I carry with me and a desktop in the office.
Whenever I go to the office daily I sync the laptop and the desktop with unison.
However it happens that I have more and more days of work out of the office, and when not in the office, it is not possible to directly sync laptop (A) to desktop (B). I have the possibility to ssh connect to a third machine, a server (C) from which I can access my office desktop, however I am granted very limited disk space on the server (I cannot use it for backup). My question is: can I sync A and B taking advantage of ssh connection with the server (but without actually saving data on the server)?
Hope this is clear. I am now familiar with using unison, but I am of course open to other solutions.
thanks for your help |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Tue Jul 31, 2012 6:25 pm Post subject: |
|
|
If you know which port unison uses for synchronization (if it uses just one port) you can setup an SSH tunnel at your server machine C, will act like a VPN. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
jormartr Apprentice
Joined: 02 Jan 2008 Posts: 174
|
Posted: Tue Jul 31, 2012 6:32 pm Post subject: |
|
|
As VinzC says, use a ssh port forward (example: 2222), and unison like
unison /local/path ssh://localhost:2222//remote/path. |
|
Back to top |
|
|
ad_meis Tux's lil' helper
Joined: 17 Feb 2006 Posts: 120 Location: Tuscany, Italy
|
Posted: Tue Jul 31, 2012 6:34 pm Post subject: |
|
|
Thanks, I ll look into this. And let you know |
|
Back to top |
|
|
ad_meis Tux's lil' helper
Joined: 17 Feb 2006 Posts: 120 Location: Tuscany, Italy
|
Posted: Wed Aug 01, 2012 7:43 am Post subject: |
|
|
I am having trouble with the correct number for the port.
Is there a way to discover what port is unison using for the synchronization? |
|
Back to top |
|
|
VinzC Watchman
Joined: 17 Apr 2004 Posts: 5098 Location: Dark side of the mood
|
Posted: Wed Aug 01, 2012 8:58 am Post subject: |
|
|
ad_meis wrote: | I am having trouble with the correct number for the port.
Is there a way to discover what port is unison using for the synchronization? |
On a *NIX machine in general I use netstat -ltaup . The -p argument will show you the process name that owns which ports in the list. _________________ Gentoo addict: tomorrow I quit, I promise!... Just one more emerge...
1739! |
|
Back to top |
|
|
jormartr Apprentice
Joined: 02 Jan 2008 Posts: 174
|
Posted: Wed Aug 01, 2012 6:43 pm Post subject: |
|
|
I think it should work doing a port forward within ssh, like:
office desktop lan ip: 10.0.0.2
office server lan ip: 10.0.0.1
office server public ip: 1.2.3.4
then, from home
ssh user@1.2.3.4 -L 2222:10.0.0.2:22
unison /local/path ssh://localhost:2222//remote/path
I write this without any test, I think its a way to make it. |
|
Back to top |
|
|
ad_meis Tux's lil' helper
Joined: 17 Feb 2006 Posts: 120 Location: Tuscany, Italy
|
Posted: Thu Aug 02, 2012 11:31 am Post subject: |
|
|
Thanks again. I cannot have it working. But it could be a mistake on my side.
The first line with the ssh connection goes fine. Troubles are with the second line. Say that username is mike on all machine, and I want to sync /home/mike on laptop and office desktop, then your last line becomes:
unison /home/mike ssh://localhost:2222//home/mike
I have tried both with "localhost" and by substituting it with what set into /etc/hosts.
This is the error message I get
Code: | [/quote]Contacting server...
ssh: connect to host localhost port 2222: Connection refused
Fatal error: Lost connection with the server |
|
|
Back to top |
|
|
jormartr Apprentice
Joined: 02 Jan 2008 Posts: 174
|
|
Back to top |
|
|
ad_meis Tux's lil' helper
Joined: 17 Feb 2006 Posts: 120 Location: Tuscany, Italy
|
Posted: Sat Aug 11, 2012 11:34 am Post subject: |
|
|
Thanks again. I have read the two links, but cannot have it working yet |
|
Back to top |
|
|
jormartr Apprentice
Joined: 02 Jan 2008 Posts: 174
|
Posted: Sat Aug 11, 2012 1:17 pm Post subject: |
|
|
Try running "ssh office_public_ip -L local_port_to_bind:local_workstation_address_on_office:office_workstation_ssh_port -v", that is, with verbose option.
and then connect to your office workstation with ssh localhost -p local_port_to_bind, and read the messages on the first command, and maybe you find something useful, like server is not forwarding ports, or something else. |
|
Back to top |
|
|
|