Warning - Old Content
This post is quite old, and it might not apply anymore, or maybe there's a better way to do the same thing nowadays. Take with a big grain of salt.
As previously mentioned, I’ve got a mac mini set up as a fileserver. That’s not very useful if I can’t easily get at the files from my linux machine. While Kubuntu fully supports browsing samba shares via smb:/machinename , that doesn’t work with most linux apps.
My first attempt was to mount the shares using smbfs, which worked okay for browsing in a terminal, but which managed to hang amarok when I tried adding them to my collection. Not cool. Instead, I’m now mounting them as cifs shares, which works much better.
First, I created a new user called “media”, that isn’t actually allowed to log in (shell is set to /bin/false). Then I added that user and my own user account to the “media” group so I can actually read and write the share.
//192.168.1.105/music /mnt/music cifs rw,nosetuids, noperm,credentials=/etc/cifs.credentials, uid=999,gid=1002,dir_mode=0775,file_mode=0775, nouser,noexec,nosuid 0 0
(the options should not be broken across multiple lines, that’s for formatting only.)
That specified a lot of options. Here’s the breakdown:
- rw - mount the share as read/write
- nosetuids - leave all user/group ownership as specified at mount level
- noperm - leave all permissions checks to fileserver
- credentials=/etc/cifs.credentials - file containing remote username and password to connect as
- uid=999,gid=1002 - uid and gid of the ‘media’ user and group as created above
- dir_mode=0775,file_mode=0664 - mount all dirs and files as writable by user and group (media:media), readable by others.
- nouser - don’t allow regular users to mount this share
- noexec,nosuid - don’t allow execution of files or any setuid binaries
Finally, set up the CIFS credentials in the file referenced: