Permission denied on network/samba share while accessing HG repo

3.2k views Asked by At

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?

2

There are 2 answers

2
Kevin Read On BEST ANSWER

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.

1
Alan Pachuau On

You can mount your network drive like this. Open your /etc/fstab/, and then enter the following line.

//IP_OR_HOSTNAME/DIRECTORY_NAME /MOUNT_DIRECTORY cifs user=sambauser,pass=sambapassword,auto,exec,umask=002,gid=1000,uid=1000,file_mode=0777,dir_mode=0777 0 0

Hope it works.