2

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

texnic
  • 1,223

1 Answers1

3

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.

  • Works like a charm. This forcing (forceuid in fstab) — is it very unsafe? – texnic Jul 14 '11 at 09:47
  • 2
    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