Search code examples
mercurialsshdvcsmercurial-server

Restrict Mercurial repository access


I have a Mercurial server using mercurial-server. I edited access.conf in hgadmin repo as follows:

deny repo=a/b
read user=x/**
read user=y/**

write repo=a/b user=x/abc
write repo=a/b user=y/z

But user z still can't access this repo. Any ideas?


Solution

  • The documentation mentions:

    user=globpattern: path to the user's key

    So the path of z's key might be wrong, or the path of the repo is off.

    When considering a request, mercurial-server steps through all the rules in /etc/mercurial-server/access.conf and then all the rules in access.conf in hgadmin, looking for a rule which matches on every condition.
    The first match determines whether the request will be allowed; if there is no match in either file, the request will be denied.

    Other possibility: Maybe a deny rule (applicable for user z) is found first.