0

So I have a Windows machine and a number of folders that I want to share my network. I've no problem mounting the folders and they have the correct permissions set in Windows. I'm mounting them using the following

sudo mount.cifs '//WINDOWS_MACHINE/WINDOWS_FOLDER' /mnt/windows_folder/ 
-o uid-1000,gid=1000,username=$USRN,password=$PASS
3
  • see askubuntu.com/questions/334422/…
    – Rinzwind
    Oct 4, 2014 at 23:11
  • 1
    Tried that, no joy. Also tried adding ",rw" to the command and this didn't work either. (also, big fan of Discworld) Oct 4, 2014 at 23:32
  • it looks to me like it says uid-1000, (typo?), it should be uid=1000 Oct 5, 2014 at 14:26

2 Answers 2

0

You appear to have a typo in one of the -o options you're passing to mount.cifs. Your goal seems to be to mount the share so its files are treated as being owned by the user whose UID is 1000 and the group whose GID is 1000.

gid=1000 is correct, but you have uid-1000. You should have uid=1000 instead (i.e., you have a - where you should have a =).

I don't know if that's the only problem, but assuming the text shown in your question is what you're using, that may explain why it's not working.

If there is not also a separate problem on the server side (which, if the share is accessible from other Windows machines with the same username and password, there probably is not), then it's likely that fix alone will resolve your problem.

That's the only actual error I've noticed, but I'll mention a mistake that's often made: Sometimes people specify their Ubuntu username and password with username= and password=. These should instead be the appropriate username and password for the Windows system that you're connecting to. (Sometimes these might be the same as your Ubuntu username and password, but only if you've deliberately set them the same on both systems.)

By the way, you might consider specifying the password interactively rather than on the command-line (so it doesn't go into your history). If you omit the password= option entirely, you should be prompted for a password to access the share. (This will be separate from the sudo password prompt.)

1
  • Oh some god. How did I not spot that. I'm such an idiot. Thanks for being more attentive than I am. :) Oct 5, 2014 at 21:03
-1

Use forceuid,forcegid,file_mode=MODE and dir_mode=MODE to explicitly control the permissions of the mounted filesystem if you have problems. Usually you don't need to set all of these unless you are using it with a certain other user (like mounting as root then using it as UID/GID=1000 in your case, you can force it to allow you (UID 1000) to be the owner of the items, hope that helps.

Just a note: Also, Windows shares are denoted with a double backslash \ not forward slash. Mount.cifs does reverse them but its a habit that can give you trouble later. Don't forget to pass 'rw' option for writing the filesystem and, make sure you use a user/passoword that has write permissions on the windows side.

1
  • Are you saying mount.cifs would actually accept backslashes in place of the slashes? (Either way, I suggest editing to make clear what you mean.) Also, the OP says s/he has already tried with rw--plus that shouldn't be necessary, provided the user (passed via username=) is configured on the server to have write access to the share--and if it isn't, explicitly mounting readwrite wouldn't help. (mount.cifs defaults to mounting readwrite.) Oct 5, 2014 at 16:19

Not the answer you're looking for? Browse other questions tagged .