Enabling replication failed, "ssh: connect to host XXX port 22; connection refused"

1,195 views
Skip to first unread message

John

unread,
Apr 28, 2011, 1:32:46 AM4/28/11
to Repo and Gerrit Discussion
Hi, I was trying to set a git replication server for my Gerrit. And
the documentation says I have to first add the host key of the remote
system (the git replication server, I guess) to the Gerrit user's
~/.ssh/known_hosts file by running the command line:
sudo su -c 'ssh XXX' gerrit2
But when i run this command line. An error occured, said
"ssh: connect to host XXX port 22; connection refused"

Would anyone tell me how to fix this problem?

Magnus Bäck

unread,
Apr 28, 2011, 2:14:39 AM4/28/11
to Repo and Gerrit Discussion
On Thursday, April 28, 2011 at 07:32 CEST,
John <zoume...@gmail.com> wrote:

The error message suggests that there's no SSH daemon running on that
host (22 is the standard SSH port), or that a firewall or similar is
blocking the access.

--
Magnus Bäck Opinions are my own and do not necessarily
SW Configuration Manager represent the ones of my employer, etc.
Sony Ericsson

John

unread,
Apr 28, 2011, 3:01:21 AM4/28/11
to Repo and Gerrit Discussion
Thank you. I found the error occured because I did not install sshd on
the host.
So I installed sshd and then run the command again. This time, it
required me to enter the password. I wonder what the password is.
Since it is not the password of the rsa key, nor the password of the
Gerrist user, nor the password of the remote host?
Then there was another error:
Permission denied (publickey, password).


On Apr 28, 2:14 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
> On Thursday, April 28, 2011 at 07:32 CEST,

Magnus Bäck

unread,
Apr 28, 2011, 4:13:17 AM4/28/11
to Repo and Gerrit Discussion
On Thursday, April 28, 2011 at 09:01 CEST,
John <zoume...@gmail.com> wrote:

> On Apr 28, 2:14 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
>
> > The error message suggests that there's no SSH daemon running on
> > that host (22 is the standard SSH port), or that a firewall or
> > similar is blocking the access.
>

> Thank you. I found the error occured because I did not install sshd on
> the host.
> So I installed sshd and then run the command again. This time, it
> required me to enter the password. I wonder what the password is.
> Since it is not the password of the rsa key, nor the password of the
> Gerrist user, nor the password of the remote host?
> Then there was another error:
> Permission denied (publickey, password).

You must set up a public/private key pair that enables the Gerrit user
on the master server to log on to the Gerrit user on the slave without a
password. In short, create a (password-less) key using ssh-keygen on the
master (unless you already have one) and append the contents of the .pub
file to the .ssh/authorized_keys file for the Gerrit user on the slave.

http://www.linuxproblem.org/art_9.html
http://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-without-password-using-ssh-keygen-ssh-copy-id/

John

unread,
Apr 28, 2011, 7:55:52 AM4/28/11
to Repo and Gerrit Discussion
Do you mean I have to create another account on the slave server for
Gerrit user? And paste the master's .pub key's content to the new
user's /home/gerrit_user/.ssh/autherized_keys on slave?

On Apr 28, 4:13 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
> On Thursday, April 28, 2011 at 09:01 CEST,
>      John <zoumeng...@gmail.com> wrote:
>
> > On Apr 28, 2:14 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
>
> > > The error message suggests that there's no SSH daemon running on
> > > that host (22 is the standard SSH port), or that a firewall or
> > > similar is blocking the access.
>
> > Thank you. I found the error occured because I did not install sshd on
> > the host.
> > So I installed sshd and then run the command again. This time, it
> > required me to enter the password. I wonder what the password is.
> > Since it is not the password of the rsa key, nor the password of the
> > Gerrist user, nor the password of the remote host?
> > Then there was another error:
> > Permission denied (publickey, password).
>
> You must set up a public/private key pair that enables the Gerrit user
> on the master server to log on to the Gerrit user on the slave without a
> password. In short, create a (password-less) key using ssh-keygen on the
> master (unless you already have one) and append the contents of the .pub
> file to the .ssh/authorized_keys file for the Gerrit user on the slave.
>
> http://www.linuxproblem.org/art_9.htmlhttp://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-with...

John

unread,
Apr 28, 2011, 9:00:18 AM4/28/11
to Repo and Gerrit Discussion
I did as http://www.linuxproblem.org/art_9.html said. And then run
sudo su -c 'ssh slave_host_name echo' gerrit_user_name
everything went fine. Then I edited review_site/replication.config as
following:
[remote "slave_host_name"]
url = user_name@slave_host_name:/home/user_name/gerritreplications/
project1.git

The user_name is the same user name I copied the .pub key to its .ssh/
authorized_keys. I then saved the file and restart gerrit. Then I run
gerrit replicate --all. And it still showed "error: re plica
tion not enabled".
I felt despaired. What on earth do I have to do to enable replication?

On Apr 28, 4:13 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
> On Thursday, April 28, 2011 at 09:01 CEST,
>      John <zoumeng...@gmail.com> wrote:
>
> > On Apr 28, 2:14 pm, Magnus Bäck <magnus.b...@sonyericsson.com> wrote:
>
> > > The error message suggests that there's no SSH daemon running on
> > > that host (22 is the standard SSH port), or that a firewall or
> > > similar is blocking the access.
>
> > Thank you. I found the error occured because I did not install sshd on
> > the host.
> > So I installed sshd and then run the command again. This time, it
> > required me to enter the password. I wonder what the password is.
> > Since it is not the password of the rsa key, nor the password of the
> > Gerrist user, nor the password of the remote host?
> > Then there was another error:
> > Permission denied (publickey, password).
>
> You must set up a public/private key pair that enables the Gerrit user
> on the master server to log on to the Gerrit user on the slave without a
> password. In short, create a (password-less) key using ssh-keygen on the
> master (unless you already have one) and append the contents of the .pub
> file to the .ssh/authorized_keys file for the Gerrit user on the slave.
>
> http://www.linuxproblem.org/art_9.htmlhttp://www.thegeekstuff.com/2008/11/3-steps-to-perform-ssh-login-with...

Shawn Pearce

unread,
Apr 29, 2011, 12:07:48 PM4/29/11
to John, Repo and Gerrit Discussion
On Thu, Apr 28, 2011 at 06:00, John <zoume...@gmail.com> wrote:
> I did as http://www.linuxproblem.org/art_9.html said. And then run
>    sudo su -c 'ssh slave_host_name echo' gerrit_user_name
> everything went fine. Then I edited review_site/replication.config as
> following:
> [remote "slave_host_name"]
>  url = user_name@slave_host_name:/home/user_name/gerritreplications/
> project1.git

This URL is incorrect. You need to include the ${name} placeholder so
the Gerrit server can fill it in with the actual project name. Try
instead:

[remote "slave_host_name"]
 url = user_name@slave_host_name:/home/user_name/gerritreplications/${name}.git

John

unread,
Apr 29, 2011, 10:48:54 PM4/29/11
to Repo and Gerrit Discussion
Oh. Ok. that works. Thank you so much! I thought I had to replace the $
{name} with a really project name in the etc.

On Apr 30, 12:07 am, Shawn Pearce <s...@google.com> wrote:
> On Thu, Apr 28, 2011 at 06:00, John <zoumeng...@gmail.com> wrote:
> > I did ashttp://www.linuxproblem.org/art_9.htmlsaid. And then run
Reply all
Reply to author
Forward
0 new messages