Search code examples
eclipseubuntumercurialsambanetwork-share

Permission denied on network/samba share while accessing HG repo


I am using EclipsePHP in Ubuntu 10.10 and try to use Mercurial (HG) to work with a repository that's located on my network-connected staging server (samba share).

When trying to refresh the repository from within Eclipse (hg status really) , I get the following error thrown in my face: abort: Operation not permitted: /media/sharename/myrepository/.hg/.dirstate* .

Whilst trying to find out what's wrong, I went to the network share from terminal and wrote hg status - the same error occurs, so it's not only occuring from within Eclipse. I tested to CHMOD the files from both my computer as well as the server - chmod 777 /media/sharename/myrepository/ -R - nothing changes.

But when I accidentally ran sudo hg status from the repo directory, Mercurial started the fireworks and worked like a charm.

What on earth is going wrong with my computer? Why can't i run my hg commands without being root?


Solution

  • chmod will not help you here I guess. The ownership and permissions on the server side are not replicated to the client (no unix extensions on server) or your UID/GID differ between both machines. You can override file ownership when mounting via:

    mount -t cifs //SERVER/SHARE /MOUNTPOINT -o uid=USERNAME
    

    This is from memory though, check man mount.cifs for details. Also, alternative networked filesystems like NFS might serve you better in this case, or try sshfs.