Can't save file to samba share

More
6 years 4 months ago #173241 by gerritv
Maybe the real problem is that hte files are root in the first place? This link references why the chmod was added but seems to not quite do what is needed. github.com/LinuxCNC/linuxcnc/issues/82

Perhaps setting Samba up using force user/group will help resolve it? www.thegeekdiary.com/how-to-force-user-g...es-on-a-samba-share/
(I presently have no way to try this but I will need this to work once I get set up, hence my interest)

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #173254 by Bats
Replied by Bats on topic Can't save file to samba share

gerritv wrote: Maybe the real problem is that hte files are root in the first place?

That bothers me a bit too (although I suppose technically the files aren't root, just the share is mounted by root) - although it seemed to be the default I ended up with when setting the box up (up until I started trying to migrate to linuxCNC, I'd been away from linux for nearly as long as from coding, and I'm discovering it's absolutely nothing at all like riding a bicycle). My gut feeling, though, is that the problem is chmod'ing files on samba shares in general, rather than the owner of said shares. The fact that even root can't do a chmod (it just fails more quietly) would seem to hint in that direction.


This link references why the chmod was added but seems to not quite do what is needed. github.com/LinuxCNC/linuxcnc/issues/82

Yeah... looks like it was an easy bandaid at the time, but now it's getting infected. Ew.

(not that I wouldn't have been inclined to do exactly the same thing)


Perhaps setting Samba up using force user/group will help resolve it? www.thegeekdiary.com/how-to-force-user-g...es-on-a-samba-share/
(I presently have no way to try this but I will need this to work once I get set up, hence my interest)

I'll have to spend more time [strike]swearing at[/strike] staring at the article and playing with it, and see if anything sensible shakes loose... or if I can figure out exactly why I got stuck with root owning the shares in the first place.


-Bats

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #173261 by andypugh
How are you navigating to the samba share?

Years ago I found that the only way to make it work was to go via the "gvfs" folder where Linux mounts Samba shares.

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #173266 by Bats
Replied by Bats on topic Can't save file to samba share

andypugh wrote: How are you navigating to the samba share?

I'm using gmoccapy's internal browser & going straight to /media/[share]/[path], where fstab mounts the share. Is there an alternative?

Years ago I found that the only way to make it work was to go via the "gvfs" folder where Linux mounts Samba shares.

I didn't even realize Xfce used gvfs... Although I suppose Thunar must have something of the sort, since it seems to have its own private mounts that I could never find from the command line.

-Bats

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago - 6 years 4 months ago #173270 by Bats
Replied by Bats on topic Can't save file to samba share
So it looks like I could get the share to mount as user:user by adding ,uid=1000,gid=1000 to the fstab line. While this is a good thing in itself, it looks like it only half-solves (or half-works-around) the saving problem.

Saving a new file to a share mounted this way (at least as long as the share owner is the same user linuxcnc is running as - I haven't tried any other scenarios) works without an error (yay!)... but trying to save to the existing file still complains - although this time it's the os.rename() that it dies on, instead of os.chmod(), and I'm not sure why.

Still digging.

-Bats
[edit: it should be noted that bats are not known for their burrowing prowess]
Last edit: 6 years 4 months ago by Bats.

Please Log in or Create an account to join the conversation.

More
6 years 4 months ago #173285 by Bats
Replied by Bats on topic Can't save file to samba share
Last update for the night... when entered line by line in the python interpreter, everything seems to work fine (at least with the new user-owned share - the root-owned one still borks on chown)... so I'm at a complete loss for why it's breaking when the application tries it.

Also, I'd made some incorrect assumptions earlier about what the os.unlink was unlinking (and some possibly disparaging & probably unwarranted remarks about the "safety" of safe_write). It looks like that's just a cleanup of the temp file - so something else apparently causes the delinking of the original file. I don't understand that bit, either.


-Bats

Please Log in or Create an account to join the conversation.

Moderators: newbynobi, HansU
Time to create page: 0.417 seconds
Powered by Kunena Forum