Easily mount SMB Share on Per User Basis

Matthew Flaschen matthew.flaschen at gatech.edu
Thu Mar 1 08:44:57 UTC 2007


Anthony M Simonelli wrote:
> I have a Ubuntu 6.10 LTSP5 Server running.  I will be adding users to
> this server that require a connection to a single Windows Share running
> on a Windows NT Server.  Each need to mount this share, but using each
> user's credentials so that the correct permissions are applied.
> Therefore, there will be a mount for each user to the same Windows Share
> in their HOME directory.  I need it mounted because then the share can
> be searched and programs that don't use Gnome-vfs can open files, such
> as Adobe Reader.
> 
> My question is, how can I have this share mounted automatically at
> login?  Would the best solution would be to write a script that uses
> smbmount and have it run with Gnome's Startup Programs section?

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20070301/4c848cab/attachment.sig>


More information about the ubuntu-users mailing list