Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a remote Samba location mounted as /mnt/rua as discussed here. I have created a folder HgRepository there, which is my central Mercurial repo. I am working with a local clone and push the setting to this folder. My team-mates do the same on their machines.

Now, the problem is that Mercurial returns

abort: could not lock repository /mnt/rua/HgRepository/spectrometry: Permission denied

if I am trying to do hg push. With hg pull as well as with sudo hg push everything works fine. This would be ok, but the problem is that the Nautilus Mercurial extension (TortoiseHg) works in the non-sudo mode, so the context menu command for pushing doesn't work.

How should I properly change the settings to make it work?

In case it helps, here is what I get for ls -l /mnt

drwxrwx--- 8 1016 users 0 2011-06-10 12:47 rua

share|improve this question
up vote 2 down vote accepted

I'm going to assume that this is a single-user machine and that your user ID is 1000 (you can check if it is by running id in a terminal).

As far as I understand, your /etc/fstab has something like/etc/fstab as follows:

//x.x.x.x/sharename  /mnt/rua  cifs  username=abc,password=def 0 1

Add forceuid,uid=1000 flags to it:

//x.x.x.x/sharename  /mnt/rua  cifs  username=abc,password=def,forceuid,uid=1000 0 1

then re-mount the share with

sudo umount /mnt/rua
sudo mount /mnt/rua

and check with ls -l that you see

drwxrwx--- 8 <yourusernamehere> users 0 2011-06-10 12:47 rua

Now you should be able to fully access the share's contents without becoming root.

share|improve this answer
Works like a charm. This forcing (forceuid in fstab) — is it very unsafe? – texnic Jul 14 '11 at 9:47
Well, if you have multiple users on this machine, forceuid will make them all able to access all the files. If you want more fine-grained protection, don't use forceuid, but then you'll have to synchronize the username -> uid mappings on the server and all the clients. If this is a single-user machine, there's no downside to using forceuid. – Marius Gedminas Jul 19 '11 at 19:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.