Permission denied on files in a directory on a CIFS-mounted Windows share in Linux

Solution 1:

It sounds to me like you should go look at the NTFS permissions on those directories on the Windows XP computer. My guess is that the user account you're using to mount those from the Fedora box doesn't have rights.

Since it's XP Media Center the "Security" tab of the folder properties might be hidden. From a command-prompt, you can use the CACLS command (as below) to list the permissions:

CACLS C:\Directory1

The output of CACLS is somewhat easy to parse, but you can post the output here as an edit to your question if you're having trouble with it.

What Windows username are you specifying in the arguments to your mount on Linux?

Edit:

Okay-- so w/o a username and password specified you're connecting as "guest". The permission "Everyone:F" is allowing that to work.

The NTFS permissions on those directories are the same. If you create a new file in each directory from either the Windows or Linux machine you should see the same access. Try that and make sure it works.

I'm wondering if you have permissions set on individual files in "directory2". Since XP Media Center "hides" the "Security" tab by default (if I remember properly), try a CACLS referencing an individual file that's giving you problems in "directory2". I suspect you'll find that it has different permissions than "directory2" itself. Did you happen to move files into "directory2" from elsewhere on the hard disk drive of the computer?

Solution 2:

This is the most frequently referred to website for this problem. Just had this enlightenment on a new setup of Windows 7 on my desktop. A week of frustration led me to use this command on my Linux system

sudo mount -v -t cifs -o user=username,vers=2.1 '//h18/Public/' /media/h18

h18 can be the URL as 192.168.0.4 /media/h18 is the directory on the Linux/Unix system Using the Users/Public directory to save defining sharing rights on the W7 System. This worked fine ONLY AFTER I had set the network access permissions on the Windows 7 system as follows:

  1. Click Start and enter Explorer
  2. In the window will be Windows Explorer. Right Click and Open program as Administrator.
  3. Right Click on Network in Windows Explorer.
  4. Choose Change advanced sharing settings and ensure that the following are selected Turn on network discovery Turn on file and printer sharing Turn on sharing so anyone with network access...... Enable file sharing for devices that use 40........ (enables my Rasberry Pies) Turn on password protected sharing AND Save Changes!!! There may be some overkill in there but for a home-computer-lab they are all pretty safe as they apply to the LAN. Hope this helps someone. Keep safe, Ianm