Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to emerge sync via ssh tunnel
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
hbp4c
n00b
n00b


Joined: 17 Apr 2002
Posts: 46
Location: Charlottesville, Va

PostPosted: Mon Apr 19, 2004 2:31 am    Post subject: How to emerge sync via ssh tunnel Reply with quote

At work, I have a cron job which rsync's the portage tree every six hours. That server runs rsyncd, and allows multiple machines to rsync against that local server to update their trees.

At home, I am on a cable modem connection completely separate from my work network.

On the server, I have allowed only the local networks I am directly responsible for (I am at a university, so we have 3 subnets allocated to my department.) Of course, I do not want to enable access to everyone on the adelphia cable network to rsync, so I found this trick to allow only my home machine to work.

First, make sure you have a valid login account on your server. So long as you can ssh to the server, you should be fine.

Next, make sure /etc/rsync/rsyncd.conf on your server has at least the following under hosts allow:
Code:

hosts allow = *.your.domain.edu \
                127.0.0.1/255.255.255.0


On your client, login as root and start the tunnel:
Code:

# ssh -L 873:localhost:873 server.your.domain.edu


If you need to login as a user and not root, you can use the -l $USER option where $USER is the account name. Leave the tunnel open during the emerge as logging out of the machine closes the tunnel.

Finally, on your client (you will have to open another terminal to do this):
Code:

# SYNC=rsync://localhost/gentoo-portage emerge sync


This will start the rsync process just like you were on the server rsyinc'ing with itself (sounds silly, but tecnically possible of course). All your data is sent over the ssh tunnel.

If you want, you can add SYNC=rsync://localhost/gentoo-portage to your /etc/make.conf, but you will always have to manually start the ssh tunnel each time you rsync the tree.

If anyone knows how to fork ssh to the background, you could set up a simple script to do this that starts the ssh tunnel then starts locally the emerge sync process.

I'm also open to better ideas or ways to improve this process.

H
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks 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