[mythtv-users] Off Topic: Auto mount samba shares

Rod Smith mythtv at rodsbooks.com
Sat Feb 24 23:58:25 UTC 2007


On Saturday 24 February 2007 18:06, Joacim J wrote:
> I have some problems with the mounting (testing samba first)
>
> The server have a share that looks like:
> ------------------------------------------------------------------------
> [movies]
>         browseable = no
>         read list = annelie,andrew,+annelie,+andrew
>         path = /var/filez1/movies
>         write list = joacim,+joacim
>         force group = nobody
>         force user = nobody
>         comment = Movies
>         inherit acls = Yes
> ------------------------------------------------------------------------
> And then I tries to mount that on the client (as root):
>
> mount -t cifs //192.168.1.2/movies /home/joacim/FRODO/Movies/ -o
> username=joacim,password=mypassword,uid=nobody,gid=nobody,file_mode=0777,di
>r_mode=0777
>
> The mount works but the permissions are not what I want. I want it to be
> forced to "nobody" and the mounted directory/files switches into "nobody"
> and I can not write to the files or create new ones. Mounting in WinXP
> using "joacim" and "mypassword" works just fine and the files are "chown"
> to "nobody"
>
> Have I missed any configuration option or .... ???

The problem is that CIFS supports usernames and Linux permissions, so when you 
mount the share, that information gets passed from the server to the client 
and the client honors that information. I can think of two possible fixes:

1) On the Samba server, locate the line in the [global] section that reads
   "unix extensions = Yes" and change it to read "unix extensions = No".
   If this line isn't present, add it and set it to "No". You'll then need
   to restart (or at least reload) Samba. This will disable the Unix
   extensions (support for Linux/Unix usernames, permissions, etc.) and your
   mount should then act more like you want it to act. The drawback is that
   you then won't have support for these features if you want them on any
   other client.

2) On the client, use a filesystem type of smbfs rather than cifs. You'll
   also need to change "file_mode" to "fmask" and "dir_mode" to "dmask",
   but everything else should work as you've specified it. If you've got a
   specific reason for using cifs rather than smbfs, of course, this won't
   work, but it means you won't need to change your server's configuration.
   FWIW, my understanding is that the Linux cifs filesystem is under active
   development but smbfs isn't. This makes cifs a safer choice for future
   support; however, smbfs is more mature and better tested.

Incidentally, I'm not sure using the user and group "nobody" is the best way 
to go. This user and group are normally used to run servers that should have 
extremely limited access to the computer; few or no files on a Linux system 
should be owned by "nobody". Assuming you simply want to set consistent 
ownership of files related to MythTV to avoid ownership and permissions 
problems, the usual approach would be to use a username and group that are 
dedicated to this task. Most distributions create a "mythtv" user and group, 
or perhaps use "video" or something similar for the user and/or group. Thus, 
it's probably better to use that account and group instead of "nobody".

-- 
Rod Smith
http://www.rodsbooks.com


More information about the mythtv-users mailing list