bofjas
bofjas

Reputation: 1206

How to make hg serve drop root priveleges after launch?

I have a HG repository on one of my computers. I sometimes develop on this machine, other times I use my laptop. I run the "hg serve" mini webserver to transfer changesets to and from my laptop.

The problem is that I have to be root in order for "hg serve" to open the network ports. When I then push a change from my laptop which creates new files, they are owned by root. And the next time I want to commit something when working on the computer serving the repositories I don't have permission to some of the file. I could do

sudo hg commit

but that just seems excessive and annoying.

Is there any way to launch "hg serve" have it open the network ports, then drop root priveleges when manipulating files?

Upvotes: 0

Views: 42

Answers (1)

Ry4an Brase
Ry4an Brase

Reputation: 78340

It won't drop privileges. If you're running a repo just for you, you should use ssh:// URLs rather than hg serve and spare yourself the hassle of running a server at all. If you're running it for more than just you, you should have nginx or apache listening on port 443 (or 80) and proxying to a production-grade wsgi container like gunicorn listining on a high-numbered port.

From hg help serve:

You can use this
for ad-hoc sharing and browsing of repositories. It is recommended to use
a real web server to serve a repository for longer periods of time.

Upvotes: -1

Related Questions