[Samba] Cannot write over root owned file

Larry Alkoff labradley at mindspring.com
Thu May 4 17:25:30 GMT 2006


david rankin wrote:
>> From: "Larry Alkoff" <labradley at mindspring.com>
>> david rankin wrote:
>>> From: "Larry Alkoff" <labradley at mindspring.com>
>>>> david rankin wrote:
>>>>> From: "Larry Alkoff" <labradley at mindspring.com>
>>>>>>
>>
>> If you have security = share it looks to me like everyone would see 
>> the samba icon but could not access it since they didn't have the 
>> password (and maybe 'valid user = david' would prevent access also).
>>
>> Or did you mean 'access the samba share' by "see"?
>>
> 
> I have security=share, and Yes I meant 'see' the share. browseable=no 
> takes care of that.
> 
>>
>>> [samba]
>>>        comment = Base Samba Share
>>>        path = /home/samba
>>>        valid users = david
>>>        force user = david
>>>        force group = ochiltree
>>>        admin users = david
>>>        browseable = no
>>>        writeable = Yes
>>>        inherit permissions = yes
>>>
>>>
>>>> What I've worked out is to mount tillie in my smbmt script with the 
>>>> line:
>>>> smbmount //tillie/all  /mnt/tillie
>>>> which picks up the $USER.
>>>> So if I run the script as $USER=root I'm root, otherwise a user even 
>>>> though my $UID=0 when I su to run the script and smbmount.
>>>>
>>>> I wish there was some way to "su" into a share but haven't seen it yet.
>>>>
>>>
>>> Well for me, its fire up PuTTy; 
>>> www.chiark.greenend.org.uk/~sgtatham/putty/
>>> ssh server, log in as me,
>>> su
>>> and you are in.
>>
>> I haven't done much PuTTy yet.  At this point I'm trying to access all 
>> shares from the Linux boxes.  I'm on a compaign to eliminate all 
>> Windows computers from my house except one or two, including changing 
>> out my wife's to a Mac.  Most of my computing time is spent at one 
>> Linux box and I only access the Windows boxen by cli to transfer a few 
>> files and to backup.
>>



Yes you understand just fine.  But see below.
> Ok, I think I understand now. You were smbmounting the windows boxes on 
> your linux box and then from your linux box using the cli to do what you 
> needed to do on the windows shares, right? I'm no expert on this, but I 
> think you have found also found the answer, "So if I run the script as 
> $USER=root I'm root". From man smbmount:
> 
> username=<arg>
>              specifies the username to connect as. If this is not given, 
> then
>              the  environment  variable   USER  is used. This option can 
> also
>              take the form "user%password" or "user/workgroup" or 
> "user/work-
>              group%password" to allow the password and workgroup to be 
> speci-
>              fied as part of the username.
> 
> So what you want is: smbmount //tillie/all  /mnt/tillie -o 
> username=root; which I presume you would have to be root to do. Using su 
> to execute some commands has always been problematic where the command 
> being issues relies on evironment variables. cron is a good example. I 
> think the user environment as seen by smbmount was what was biting you 
> in this case. Others with far more knowledge than I may want to weigh in 
> or add more detail if required.
> 

Your command
smbmount //tillie/all  /mnt/tillie -o  username=root;
is ok as far as it goes but I have found by experiment that you don't 
need the -o username=root.

 From man smb.conf (I think):
paraphrase:  smbmount picks up the username automatically.
So if I smbmount with either lba as user or su to lba as user but UID=0, 
  you would not have root access but if smbmount from root (su -) then 
you are root on the target machine.

So most of my mount lines in smbmt (my script) are:
smbmount //service/share /mnt/service
and I don't have to worry about if statements to sort out
-o username=whatever.

It's working quite nicely now :-)

Larry

-- 
Larry Alkoff N2LA - Austin TX
Using Thunderbird on Slackware Linux


More information about the samba mailing list