Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
using unison on server to sync with machine inside a network
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
ad_meis
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 120
Location: Tuscany, Italy

PostPosted: Tue Jul 31, 2012 4:58 pm    Post subject: using unison on server to sync with machine inside a network Reply with quote

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
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Tue Jul 31, 2012 6:25 pm    Post subject: Reply with quote

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
View user's profile Send private message
jormartr
Apprentice
Apprentice


Joined: 02 Jan 2008
Posts: 174

PostPosted: Tue Jul 31, 2012 6:32 pm    Post subject: Reply with quote

As VinzC says, use a ssh port forward (example: 2222), and unison like

unison /local/path ssh://localhost:2222//remote/path.
Back to top
View user's profile Send private message
ad_meis
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 120
Location: Tuscany, Italy

PostPosted: Tue Jul 31, 2012 6:34 pm    Post subject: Reply with quote

Thanks, I ll look into this. And let you know
Back to top
View user's profile Send private message
ad_meis
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 120
Location: Tuscany, Italy

PostPosted: Wed Aug 01, 2012 7:43 am    Post subject: Reply with quote

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
View user's profile Send private message
VinzC
Watchman
Watchman


Joined: 17 Apr 2004
Posts: 5098
Location: Dark side of the mood

PostPosted: Wed Aug 01, 2012 8:58 am    Post subject: Reply with quote

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
View user's profile Send private message
jormartr
Apprentice
Apprentice


Joined: 02 Jan 2008
Posts: 174

PostPosted: Wed Aug 01, 2012 6:43 pm    Post subject: Reply with quote

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
View user's profile Send private message
ad_meis
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 120
Location: Tuscany, Italy

PostPosted: Thu Aug 02, 2012 11:31 am    Post subject: Reply with quote

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
View user's profile Send private message
jormartr
Apprentice
Apprentice


Joined: 02 Jan 2008
Posts: 174

PostPosted: Thu Aug 02, 2012 12:06 pm    Post subject: Reply with quote

Take a look at some documentation or these:

http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html
https://help.ubuntu.com/community/SSH/OpenSSH/PortForwarding

you are interested in local port forwarding.
Back to top
View user's profile Send private message
ad_meis
Tux's lil' helper
Tux's lil' helper


Joined: 17 Feb 2006
Posts: 120
Location: Tuscany, Italy

PostPosted: Sat Aug 11, 2012 11:34 am    Post subject: Reply with quote

Thanks again. I have read the two links, but cannot have it working yet
Back to top
View user's profile Send private message
jormartr
Apprentice
Apprentice


Joined: 02 Jan 2008
Posts: 174

PostPosted: Sat Aug 11, 2012 1:17 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum