Am Sonntag, 30. Juli 2017, 14:31:48 CEST schrieb gumb:
[...] I had to put all this aside for a while, but have run up against other issues since my last posts. Having never attached any storage to a network previously, I'd never even given a moment's thought to how it would work regarding file ownership and permissions.
That's why I bought my first NAS about eight years ago: To learn. I solved the file ownership and permission problems on samba shares by using the posix extensions. Unfortunately, this restricts me to use SMB version 1.0 because there are still no posix extensions for 2.x or 3.x. Well, at least all of my NAS support this extension...
I believe I last copied the music collection onto the drive via FTP. I hit a snag when I tried to save a playlist in Clementine by overwriting one already existing in the Playlists folder on the network drive. Though there was no error message, I could see in the file manager that the file wasn't being modified. After playing around a bit I found I could save it in the root directory of the attached drive but not in the music collection folder. Initial examinations weren't aided by Thunar merely showing all ownership as being 'root', which when examined later on my openSUSE box proved to be incorrect.
Sadly, samba seems to work that way. Samba mounts are generally single-user and all files and directories will have the same owner and permission locally, regardless of the actual owner and permissions defined by the underlying file system. Nonetheless, even if you have local permissions to access any of them, the actual ownership and permissions kick in and then, additionally, the the samba server share definitions. So, you need local permissions to access /home/media. These are the "uid" and "gid" fstab options for. Assuming your username is gump, you can add "uid=gumb" and "gid=users" as fstab options (if in doubt, "id" in a terminal will tell you both). Then, you will see all files as if they were owned by you and you should have access to them as long as the underlying file system or the samba server don't deny it.
The files and directories created by the router have user and group ownership of 'freebox', and UID/GID of 4242.
Since you are accessing your freebox via samba as a guest, the server doesn't know who you actually are and, thus, cannot set the ownership of new files and directories to "you". Instead, it maps them to a default user with the uid/gid 4242.
However, the music collection that I copied over with FTP has ownership by my regular username and UID of 1001 (common on both connected PCs).
The ftp client can change the ownership and permissions via "SITE CHOWN" and "SITE CHMOD" (if the server permits this).
I feel like I'm opening up a whole new can of worms with this. I've tried reading wiki pages on CIFS and I still haven't the froggiest what's what with that and Samba, etc. It's all new to me. I tried adding the drive to the fstab using a modified version of the line advised above, in this case: [...] Amongst my web searches I stumbled upon this random page: https://wiki.ubuntu.com/MountWindowsSharesPermanently I see there it shows an fstab line where 'ext4' is replaced by 'cifs'. Is this what is considered the 'old' (pre-systemd) way of doing things, related to the autofs method mentioned above? I'm rather reluctant to do anything by an 'old' method even if it still works, just for sake of not having to relearn in future as I continually upgrade and replace machines and those old methods become redundant.
Ah, sorry, I forgot the the file system type field in fstab. :-( And cifs is not "old-style" but simply the file system type for a samba network share and completely independent of systemd and autofs. //192.168.0.254/media /home/media cifs guest,uid=gumb,gid=users,noauto,x- systemd.automount,x-systemd.idle-timeout=60,nofail 0 0 You won't need "_netdev" because systemd knows that cifs is a network share and "noatime" should give you an error for cifs. You might have to add "user" but it shouldn't be necessary with if "x-systemd.automount" is added.
That page also mentions other things like the addition of uid=1001 to the fstab line, but I don't know if that's what I should be trying to do.
See above, and I added "uid=gumb" and "gid=users".
Should I be attempting to leave the 'freebox' ownership and permissions of all files as they are and always log in anonymously as a guest, or should I be trying to set it up so that everything has my ownership and ID? I'd have thought the latter, bearing in mind I will sometimes unplug the drive to take it with the laptop elsewhere, and so perhaps I should forget anonymous login and set my regular PC login username and password here? http://paste.opensuse.org/6604f82a However, the freebox will likely insist upon its own ownership for folders relating to other integrated functions like the TV recording and downloads. Perhaps the two methods can coexist.
As far as I can see, you cannot specify the uid your freebox will use. So, even if you log in as "gumb", the uid won't necessarily be 1001 on your freebox.
[...] Result: the router now complains about the drive being unavailable. All verifications of the partition fail. I've looked at it plugged in directly to the PC, checked all hidden files, erased the two relating to the half-recorded programme, confirmed there's absolutely nothing else on there. But still it doesn't want to know any more. I've restarted the router in safe mode, done everything I can. Something's irreversibly corrupted, even though all the files are intact. Will have to reformat the partition, for the fourth time. But before I copy everything over again, I should figure out the implications of file ownership.
Too bad, but I have no idea why your freebox doesn't like your hard disk anymore while your PC still does. Searching these French support forums isn't that easy for me... Gruß Jan -- When two people meet to decide how to spend a third person's money, fraud will result. -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse+owner@opensuse.org