0

This question already has an answer here:

I have mounted a Windows 10 directory so I can edit some files on my Windownz machine.

sudo mount -t cifds //W10/Users ~/public/ -o username=bobby

When checking the directories they all have the owner root and as user bobby I only have read permission.

I already used chown and chmod to change the owner and permissions. The verbose output all told me that the owner was changed for instance but it was not. I was not able to edit files in there with user bobby.

What am I getting wrong in this case?

marked as duplicate by sebasth, A.B, user88036, G-Man, Romeo Ninov Sep 25 '18 at 3:06

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Unix file systems and Windows file systems are different. You have to provide the owner with the uid option because the SMB client will not be able to extract an owner from the Windows file system. As the owner presented to the Linux programs doesn't exist, it's not possible to change the owner. This leaves two possibilities for system calls like chown.

  • They can either return failure, because they can't succeed, but that would lead to many warning messages or even to programs the stop once they fail.
  • Or they can pretend that they succeeded. Many programs operate smoothly thinking that everything worked as expected, but it can also be confusing when you expect the operation to actually succeed.

So you aren't doing anything wrong, the software doesn't support it.

You can use the uid and gid options to specify user and group for all files in the mounted file system. You can also use file_mode and dir_mode for the permissions of files and directories.

Edit

See man mount.cifs.

Exmaples:

  • This will give read/write access to everybody. Use with caution.

    mount -t cifs //W10/Users ~/public/ -o username=bobb,dir_mode=777,file_mode=666
    
  • This will mount the file system as user and group

    mount -t cifs //W10/Users ~/public/ -o username=bobb,uid=user,gid=group
    
  • Sorry I am not able to follow you with those uid and gid options. Which tool has those? chown,mount or smbclient ? Can you maybe provide a little example to give me a hint? – xetra11 Sep 24 '18 at 20:32
  • It's in mount.cifs, or mount -t cifs. – RalfFriedl Sep 24 '18 at 20:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.