Easily mount SMB Share on Per User Basis

Clive Menzies clive at clivemenzies.co.uk
Thu Mar 22 18:21:57 UTC 2007


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

-- 
www.clivemenzies.co.uk ...
...strategies for business






More information about the ubuntu-users mailing list