Easily mount SMB Share on Per User Basis

Gabriel Dragffy dragffy at yandex.ru
Sat Apr 21 23:19:59 UTC 2007


Clive Menzies wrote:
> On (21/03/07 21:40), Gabriel Dragffy wrote:
>> Matthew Flaschen wrote:
>>> The below is a hack :) :
>>>
>>> You should just be able to use /etc/fstab
>>> (http://www.tuxfiles.org/linuxhelp/fstab.html).  For some reason smbfs
>>> needs root privileges so doing it on login won't work.  Try something like:
>>>
>>> //smb.yourserver.edu/	/home/username/smb	smbfs
>>> username=username,uid=1000,gid=1000,fmask=700,password=PASSWORD	0	0
>>>
>>> You need to create a separate entry with the username, password,
>>> mountpoint, uid & gids for each users.  That means all the directories
>>> will be mounted at the same time (which might be impossible if we're
>>> talking about a large number of users), but unix permissions should
>>> prevent users from seeing each others files.
>>>
>>> Also, make sure you run
>>>
>>> sudo chmod go-r /etc/fstab
>>>
>>> to stop users (in theory...) from seeing each others passwords.
>>>
>>> Matthew Flaschen
>>>
>>>
>> I've been trying to do something like this on my machine too. I edit 
>> fstab as necessary, and then run sudo mount -a, it always gives me an 
>> error about bad fs, bad superblock, bad option etc. I have tried every 
>> combination I can think of :(
> 
> I believe smbfs is now depricated for cifs.
> 
> Try loading the cifs module (I use modconf)
> 
> and then I do:
> 
> //server/share /smb/share     cifs  credentials=/home/user/.smb_pass,uid=user,gid=group,file_mode=0660,dir_mode=0770  0       0
> 
> 
> YMMV
> 
> Regards
> 
> Clive
> 

I'm trying to copy these instructions also... no luck yet. I have 
ensured the cifs module is loaded (modprobe cifs), and tried every 
combination of commands that I can think of, and obviously non of them 
are correct. Also an error about a bad fs, option or codepage type. :(




More information about the ubuntu-users mailing list