In my
previous
post I moved my first steps with Mercurial DVCS, now I'll install
a Mercurial server implementation and configure both my computers to
access it using SSH protocol.
Mercurial-server
With DVCS you don't
have to use a central
server, repositories could be shared over LAN using shared folders,
but this doesn't mean you
can't have one.
Various
mercurial server side implementations exists, using different
protocols. May be I'm too
server-client minded but I didn't
feel satisfied by just sharing repositories over a shared folder so I
decided to install
Mercurial-server.
Installing Mercurial-server is an easy task the
command
sudo apt-get install mercurial-server
complete the installation process and the creation
of the application user (hg). A bit more complex is configuring SSH
for accessing the server, I mainly followed instructions from
here
and from Mercurial-server
documentation.
Mercurial-server uses public-key authentication and
SSH-Agent in order to grant access to its clients, so the first step
has been to generate a keys couple for SSH. The ssh-keygen command
does this interactively.
maxx@VeritonS661:~$ ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key
(/home/maxx/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in
/home/maxx/.ssh/id_dsa.
Your public key has been saved in
/home/maxx/.ssh/id_dsa.pub.
I then copied the public key in mercurial-server
keys configuration path and told mercurial-server to refresh its
authentication files, using the following commands:
ssh-add -L > maxx.key
sudo mkdir /etc/mercurial-server/keys/root/maxx
sudo cp maxx.key /etc/mercurial-server/keys/root/maxx
/veritons661
sudo -u hg /usr/share/mercurial-server/refresh-auth
the usual path for mercurial-server keys is (for
root users)
/etc/mercurial-server/keys/root/<user-name>
but if the same user must be accessed from different
machines a different path is used:
/etc/mercurial-server/keys/root/<user-name>/<machine-name>
since I was going to add the maxx user from
the EEEPC too I had to use, of course, the second from. On the EEEPC
side I generated SSH keys at the same manner then, after logging to
the desktop computer (the server) with:
ssh -A veritons661
and I eventually registered EEEPC's maxx user
like this
ssh-add -L > eeepc900.key
sudo cp eeepc900.key
/etc/mercurial-server/keys/root/maxx/eeepc900
sudo -u hg /usr/share/mercurial-server/refresh-auth