Please support VectorLinux!

Author Topic: Write access for non-root user on samba mounted share. [SOLVED]  (Read 6010 times)

dukefluke

  • Member
  • *
  • Posts: 31
I have setup my 5.9 standard gold system to mount a samba share on  a Vista Ultimate machine.
I have the share mounted at /media/smb with :

Code: [Select]
mount -t smbfs -o username=duke,password=xxx //vistamachine/Share /media/smb
If I use a terminal to cd to the share then I can create a file with something like:

Code: [Select]
touch somefile.txt
As long as I am root user. As my regular user (duke) I cannot write only read.
Before mounting at /media/smb I did:

Code: [Select]
chown duke smb
And after mounting and finding out I don't have write permission I tried:

Code: [Select]
chown -R duke smb
Which gave me a whole bunch of "Operation not Permitted" errors.

How can I give my regular user write access to samba mounts?
« Last Edit: July 25, 2008, 09:13:47 am by dukefluke »

newt

  • Vectorian
  • ****
  • Posts: 1132
Re: Write access for non-root user on samba mounted share.
« Reply #1 on: July 24, 2008, 10:52:27 pm »
It looks like by adding a userid or groupid to the -options you should be able to give writable permissions to non-root users.

Examples:
mount -t smbfs -o username=duke,password=xxx,uid=dukefluke //vistamachine/Share /media/smb
mount -t smbfs -o username=duke,password=xxx,gid=users //vistamachine/Share /media/smb

HTH!
newt

nightflier

  • Administrator
  • Vectorian
  • *****
  • Posts: 4072
Re: Write access for non-root user on samba mounted share.
« Reply #2 on: July 25, 2008, 05:40:44 am »
You can try mounting the share as user "duke" with smbmnt

On my machine I gave my regular user su power to the mount command, that way I can easily mount using cifs, which has some advantages over smbfs.

bigpaws

  • Vectorian
  • ****
  • Posts: 1868
Re: Write access for non-root user on samba mounted share.
« Reply #3 on: July 25, 2008, 06:51:23 am »
The problem is that /media is root/root.

Change the /media/smb permissions to your username and
the group users.

Bigpaws

dukefluke

  • Member
  • *
  • Posts: 31
Re: Write access for non-root user on samba mounted share.
« Reply #4 on: July 25, 2008, 07:35:22 am »
Thank you everyone for your replies.

I tried smbmount(set suid on it) and while reading the man page for it I saw this:

Code: [Select]
WARNING:  smbmount  is deprecated and not maintained any longer.  mount.cifs (mount
       -t cifs) should be used instead of smbmount.

And I was like whoa! what is this cifs thing? I only ever used smbmount. So anyways rather than learn about
uid's and gid's right now(I'm lazy) I decide to use mount.cifs to mount in duke's home directory and that works fine.

Thanks again everyone. And thank you to the Vector linux team!   :D



dukefluke

  • Member
  • *
  • Posts: 31
Re: Write access for non-root user on samba mounted share.
« Reply #5 on: July 25, 2008, 09:12:34 am »
Ok heres an update.

After mounting in my home dir with :

mount.cifs

I decided auto mounting would be nice so I went back to trying to mount in /media/smb: which I accomplished by editing my fstab and adding:

Code: [Select]
//vistamachine/Users /media/smb cifs exec,user=duke,password=xxx,uid=1000 0 0

I was able to determine my UID with :
Code: [Select]
id -u duke
and then "mount -a" bingo!

Thanks for the GID,UID,cifs info guys it got me on the right track!