[NTLUG:Discuss] Accessing samba dir

chamster chamster at cyberianhamster.com
Sat Sep 1 20:13:19 CDT 2001


On Fri, Aug 31, 2001 at 02:35:27PM -0400, Patrick Parks wrote:
> 
> is there any way to mount a Samba filesystem without having to be root?
> I can mount as root and all is good, but if I su to root, mount the file
> system and try and copy files to it as user, I dont have permission to
> do it. Any way around this? TIA.

I think the issue here is that you have to tell mount what user and group
will be ascribed to the mounted filesystem.

For example, if I just say

mount -t smbfs -o username=foo,ip=192.168.1.1 //foobar/homes
/home/foo/mount_here

and I am root, then the client will mount this filesystem as user id=root,
group id=root even though you're logging in through your samba userid. When you
exit out and become a normal user again, you can't modify it just as you
couldn't modify other root owned files.

To get around this, you have to set the uid and gid equal to the user
desired. So, something like...

mount -t smbfs -o username=foo1,ip=192.168.1.1,uid=foo2,gid=foo2 //foobar/homes
/home/foo2/mount_here

where foo1 = your Samba account and foo2 = userID at the client account that
you're using.

To save some time, you could put this in a start-up script with the password
option in the line (file only to be read by root), and then it would mount it
automatically on boot-up. If you're not comfortable doing this, then sudo
would help you by not having to su to root first all the time.

HTH,

Steve



More information about the Discuss mailing list