Page 1 of 1
Re: mount read/write
Posted: Tue May 01, 2012 1:01 pm
by itsonlyme
I am sure that I have read something about this on this forum but I cannot find it. Probably wrong search terms on my part.
I added lines like this to my fstab
//192.168.xxx.xxx/raspberrypi /mnt/raspberrypi cifs username=user
This works except that as a user I can only access the files as read only, but as root I can access them as read/write.
I have tried changing the ownership of the directory using chmod and with initially permission 0777, but whilst the process starts it ends with a permission denied error.
What I want to end up with is raspberrry booting with read/write access for all users on these shared files.
Help please!
Many thanks
Re: mount read/write
Posted: Tue May 01, 2012 1:12 pm
by bredman
I assume you used the command
sudo chmod
Re: mount read/write
Posted: Tue May 01, 2012 1:27 pm
by itsonlyme
Yes. I did
Re: mount read/write
Posted: Tue May 01, 2012 1:41 pm
by plugwash
I think you need to look through the mount options for cifs, there should be some options to set the ownership and permissions it simulates (you can't use chmod because the permissionsettings you are trying to change don't really exist, they are just generated by the cifs module).
Re: mount read/write
Posted: Tue May 01, 2012 2:25 pm
by rurwin
The search you want (on Google, not the forum) is "man cifs".
The options you probably want are
file_mode=777 dir_mode=777
It would also work if you set the file ownership to you.
uid=username gid=username forceuid forcegid
(Assuming the common standard where you are a member of the group with the same name as your username.)
Re: mount read/write
Posted: Tue May 01, 2012 3:12 pm
by Joe Schmoe
The salient point here is that the "username" option specifies the ID to connect to the remote server as, while "uid" (and "gid") specifies the ID to expose the local connection as.
There is also an option "user", which specifies that users (i.e., any user) can do the mount and get the remote share exposed as the invoking user. Note that I have not done any "man-ning" or checking, so I can't give the details on how the "user" option works (syntax).
Re: mount read/write
Posted: Tue May 01, 2012 3:23 pm
by itsonlyme
I have added the option "file_mode=777,dir_mode=777" after the username option. This actions but does not solve the problem on its own as I can still only see the files as root.
This is as far as I will go today as eyes getting rather tired. Back to it tomorrow and will look at the uid and gid etc..
Thanks all for your pointers
Re: mount read/write
Posted: Wed May 02, 2012 1:04 pm
by itsonlyme
I have now solved this. Thanks to all who responded.
I am a complete newbie to Linux and mounting was the first real problem I had. For other issues I was quickly able to find the answers with "man" or google. For that reason I think it should be included in the wiki or in a beginners guide, but not by me as it needs checking by an expert.
For other newbies you need a line like this in your fstab file (all on one line).
//192.168.xxx.xxx/documents /mnt/documents cifs username=xxxxxxx,uid=1000,gid=1000
where:-
192.168.xxx.xxx is the IP address of the computer whose files you want to access
/documents is the folder on that computer that you want to access
/mnt/documents is the location on the Raspberry you want to mount to
username is your login name on the computer you are accesssing. If this is password protected you need to follow it with "password=(your passsword on that computer),"
uid is your user id on raspberry. You can get this by typing "id-u pi" in a terminal. Where pi is your raspberry login name.
gid is your group id on raspberry. To get this type "id-g pi" etc.
Spaces. There is a space after each instance of documents, and also after cifs. There are no other spaces.
Security. If you have entered any passwords, note that they are visible in plain text in the fstab file. There is a way to avoid this using credentials, but I have not explored it.