permission denied when removing files on remote file share that is offline

Thielemans, Kris
Mon Sep 6 17:45:00 GMT 2010

Hi Corinna

many thanks for your quick answer. My reply is at the bottom
On Sep  6 15:33, Thielemans, Kris wrote:
> Hi
> I think my problem appeared after upgrading to cygwin  1.7.7 but it might have been present before that as well, I am not sure.
> I'm using a file share with Offline Folders such that I can access it when not connected to our intranet. In cygwin I cannot remove any files that I create on the share when it's offline: 
>   $  touch /xxx/testfile
>   $ rm /xxx/testfile
>   rm: cannot remove `/xxx/testfile': Permission denied
> I can create/modify the files without trouble, but not delete them. I can delete the file with Windows Explorer. getfacl doesn't show anything strange. I can delte the file once the file share gets @connected@ again. Everything works fine on my local disks. 
> This happens both when specifying the file share, or when using a drive letter:
>   $ mount //fileserver/myusername$ /xxx
>   $ mount h: /xxx
> Some extra info:
> $ net use
> New connections will be remembered.
> Status       Local     Remote                    Network
> -------------------------------------------------------------------------------
> OK           H:        \\fileserver\myusername$               Microsoft Windows Network
> The command completed successfully.
> after mounting the file share explicitly
> $ mount |grep xxx
> //fileserver/myusername$ on /xxx type ntfs (binary,notexec,user)

Strange.  I cannot reproduce this problem.  I created a share on a 
server just for this purpose, then, on the client, made it available
offline and synced it once.  Then I disconnected the NIC:

  $ net use
  Status       Local     Remote                    Network
  Disconnected H:        \\fileserver\myusername$               Microsoft Windows Network
  The command completed successfully.

  $ touch /mnt/h/xyz/testfile
  $ rm /mnt/h/xyz/testfile

Works like a charm.  I tried the same with an additional explicit Cygwin
mount, which worked fine as well.

Can you run rm under strace?  Maybe there's a status code which gives
some helpful information.  Look for the "unlink_nt" function.


I did the following

$ strace rm /h/TEMP/testfile > /h/TEMP/rm.log
rm: cannot remove `/h/TEMP/testfile': Permission denied

The few lines around unlink_nt are as follows (full log file attached):

   87  230535 [main] rm 5200 path_conv::check: this->path(H:\TEMP\testfile), has_acls(0)
 1107  231642 [main] rm 5200 unlink_nt: Setting delete disposition failed, status = 0xC0000022
  117  231759 [main] rm 5200 seterrno_from_nt_status: /ext/build/netrel/src/cygwin-1.7.7-1/winsup/cygwin/ status 0xC0000022 -> windows error 5
   94  231853 [main] rm 5200 geterrno_from_win_error: windows error 5 == errno 13
   77  231930 [main] rm 5200 unlink: -1 = unlink (/h/TEMP/testfile)

Does this help?

A few things that might be relevant:

- Even after disconnection (e.g. switching off wireless etc), "net use" still reports "OK" for my drive, not "DISCONNECTED" as in your case.

- I did not make the whole drive available offline, but only some subfolders. (It's too big for the whole thing). In the above example, h:\TEMP *is* made available offline. However, I just tried to map z: to \\fileserver\username$\TEMP, where z: is then available offline, and then repeat the above experiment, with the same (negative) result.

- I forgot to say that I'm running XP sp3.

Thanks again


-------------- next part --------------
A non-text attachment was scrubbed...
Name: rm.log
Type: application/octet-stream
Size: 66584 bytes
Desc: rm.log
URL: <>
-------------- next part --------------
Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list