Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[SOLVED] portage rsync via ssh
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 663
Location: Barcelona, Spain

PostPosted: Fri May 02, 2014 4:43 pm    Post subject: [SOLVED] portage rsync via ssh Reply with quote

From what I understand from the man page, it would be possible to define a site-specific repository configuration information using this format in
/etc/portage/repos.conf:

Code:
[DEFAULT]
main-repo = gentoo

[gentoo]
location = /usr/portage
sync-type = rsync
sync-uri = ssh://public@server:port/usr/portage


I have not been able to use a non standard port, so I finally used port 22. I get this message:

Code:
emerge --sync
>>> Synchronization of repository 'gentoo' located in '/usr/portage'...
>>> Starting rsync with ssh://public@server:22/usr/portage...
>>> Checking server timestamp ...
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: unexplained error (code 255) at io.c(605) [Receiver=3.0.9]
>>> Retrying...
!!! Exhausted addresses for server


User root can access the server using public key authentication, but I imagine that emerge is using the "portage" user. I wonder how do I set the public key authentication for user "portage".

This is my portage user:
Code:
# grep portage /etc/passwd
portage:x:250:250:portage:/var/tmp/portage:/bin/false


And I have set the public key configuration in /var/tmp/portage without success.

Thanks for your attention!
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved.
Take care of the community answering unanswered posts.


Last edited by mimosinnet on Tue May 06, 2014 2:30 pm; edited 1 time in total
Back to top
View user's profile Send private message
krinn
Watchman
Watchman


Joined: 02 May 2003
Posts: 7071

PostPosted: Sat May 03, 2014 7:56 am    Post subject: Re: portage rsync via ssh Reply with quote

mimosinnet wrote:
Code:
sync-uri = ssh://public@server:port/usr/portage

User root can access the server using public key authentication, but I imagine that emerge is using the "portage" user. I wonder how do I set the public key authentication for user "portage".

Try
PORTAGE_RSYNC_EXTRA_OPTS = -e "ssh -l root@server" and keep RSYNC_URI a classic rsync link as rsync://server
So rsync use root@server for ssh connection but use whatever portage gives him as rsync user
Back to top
View user's profile Send private message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 663
Location: Barcelona, Spain

PostPosted: Mon May 05, 2014 9:36 am    Post subject: Re: portage rsync via ssh Reply with quote

krinn wrote:
PORTAGE_RSYNC_EXTRA_OPTS = -e "ssh -l root@server" and keep RSYNC_URI a classic rsync link as rsync://server
So rsync use root@server for ssh connection but use whatever portage gives him as rsync user


Thanks for the suggestion. I have tried the following:

In /etc/portage/make.conf:
Code:
PORTAGE_RSYNC_EXTRA_OPTS='-e "ssh -l root@psico_portage"'


In /etc/portage/repos.conf/gentoo.conf
Code:
[DEFAULT]
main-repo = gentoo

[gentoo]
location = /usr/portage
sync-type = rsync
sync-uri =  rsync://psico_portage/usr/portage


As root, I can log to root@psico_portage using public-key authentication using this command:
Code:
ssh -l root psico_portage


Nevertheless, I get the same message:

Code:
# emerge -d --sync
myaction sync
myopts {'--debug': True}
>>> Synchronization of repository 'gentoo' located in '/usr/portage'...
>>> Starting rsync with rsync://158.109.174.188/usr/portage...
>>> Checking server timestamp ...
['/usr/bin/rsync', '--recursive', '--links', '--safe-links', '--perms', '--times', '--omit-dir-times', '--compress', '--force', '--whole-file', '--delete', '--stats', '--human-readable', '--timeout=180', '--exclude=/distfiles', '--exclude=/local', '--exclude=/packages', '--verbose', '--checksum', '-e', 'ssh -l root@psico_portage']
Permission denied (publickey).
rsync: connection unexpectedly closed (0 bytes received so far) [Receiver]
rsync error: error in rsync protocol data stream (code 12) at io.c(605) [Receiver=3.0.9]
>>> Retrying...
!!! Exhausted addresses for psico_portage


I guess emerge switches to a user that does not have the ssh public-key authentication defined, so it cannot "root@psico_portage".

Any suggestions appreciated!
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved.
Take care of the community answering unanswered posts.
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2152
Location: Berlin, Germany

PostPosted: Mon May 05, 2014 12:38 pm    Post subject: Reply with quote

I suggest to specify the ssh identity key file directly via PORTAGE_RSYNC_EXTRA_OPTS. The key and its directory must be accessible by the portage user.
make.conf:
PORTAGE_RSYNC_EXTRA_OPTS="-e \"ssh -l remoteuser -i ~localuser/.ssh/id_rsa\""
or similar.
Back to top
View user's profile Send private message
mimosinnet
l33t
l33t


Joined: 10 Aug 2006
Posts: 663
Location: Barcelona, Spain

PostPosted: Tue May 06, 2014 2:42 pm    Post subject: Reply with quote

chithanh wrote:
I suggest to specify the ssh identity key file directly via PORTAGE_RSYNC_EXTRA_OPTS. The key and its directory must be accessible by the portage user.
make.conf:
PORTAGE_RSYNC_EXTRA_OPTS="-e \"ssh -l remoteuser -i ~localuser/.ssh/id_rsa\""
or similar.


Your suggestion has worked! :D :

PORTAGE_RSYNC_EXTRA_OPTS="-e \"ssh -l root -i /home/public/.ssh/public \""

I have only been able to make it work with user "root".

Thanks a lot!

Cheers!
_________________
Please add [solved] to the initial post's subject line if you feel your problem is resolved.
Take care of the community answering unanswered posts.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo 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