LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   can't mount samba share and then write to the share (http://www.linuxquestions.org/questions/linux-software-2/cant-mount-samba-share-and-then-write-to-the-share-138313/)

calbazon 01-24-2004 10:44 PM

can't mount samba share and then write to the share
 
I would like to link, mount or otherwise associate a samba share on my Redhat 9 machine so that I may use it (read and write) just like it was on my Redhat machine.

I tried this:
made a subdirectory in my home folder called winmachine.
then, as root, did
# mount -t smbfs //winmachine/c /home/user/winmachine/
I can then see the windows share in my home directory but I don't have write permissions. I can't change the premissions of that subdir, even as root.

Any ideas?:confused:

rlkiddjr 01-25-2004 12:01 AM

When you mounted the share, you mounted as root. This made all the files belong to root. The reason you can not change the file permissions is because the share is overriding it.

To get around that, when mounting the smb share use the uid=, or gid= statement in the command. At that point if you are the user or belong to that group then you can do anything that you want.

Hope this makes sense

calbazon 01-25-2004 12:34 AM

Wow! You rock!
 
Well, what do ya know? It worked!

Thanks so very much! That problem was driving me nuts! :eek:

One last thing.
How can I get Linux to do that at boot? I get asked for a password for the samba share when mounting it so do I have to pass that in to the command? How? Thanks again!

Doc...

jamie_barrow 01-25-2004 04:16 AM

I'm not sure about this, but I think it may work:

In the file /etc/fstab is where all the mountpoints are declared for your system.

For your requirements, its format is this, per line:
DEVICE MOUNT_PATH MOUNT_TYPE OPTIONS 0 0

so for your share, you would add a line:
//winmachine/c /home/user/winmachine smbfs OPTIONS

...where options is whatever options you decide on - try "# man fstab" and "# man mount" for more info.

The most probable OPTIONS would be:
auto,user,_netdev

...which should mount the share at boot time or when "mount -a" is called, and only when network is available.

I hope this works :)

Jamie --- Proudly South African

rlkiddjr 01-25-2004 09:43 AM

Put something like this in your /etc/fstab file. Of course fill in the correct values. Which everone of the ids you are not using just set it to 0.

//server/share /some/mountpoint smbfs password=password,uid=?,gid=?,username=username 0 0

Hope this helps

calbazon 01-25-2004 10:43 AM

Wow again rlkiddjr!

It worked like a charm! Thanks again for all your help! I was searching all over the Internet looking for a solution because I don't like to post questions when someone else has already posted a solution somewhere but after no luck I tried here. Great advice!

Jamie, thanks for your post! I did not try your solution because rlkiddjr's worked the first time right out of the box but thanks for posting! I really appreciate it!
Doc....

jamie_barrow 01-27-2004 11:52 AM

Sure thing. Ours are basically the same, but his is better as he actually lists the options you needed :)

Beauford2008 10-10-2010 12:13 AM

I have the same problem and came across this post and tried what it said, but I can still not write to my Windows shares from Slackware - permission denied.

This is my fstab entry:

//192.168.58.100/windows /home/username/share smbfs password=password,uid=100,gid=10,username=username 0 0

It mounts fine, but only root can write to it. I can see it and access the files, but can't save move, delete, etc.

Any help is appreciated.

B

Beauford2008 10-10-2010 01:35 AM

Found it. Thanks


All times are GMT -5. The time now is 05:54 AM.