[Samba] Cannot write over root owned file

Larry Alkoff labradley at mindspring.com
Wed May 3 05:53:34 GMT 2006


Adam Nielsen wrote:
>> Is there something built-in to Samba to prevent root overwriting a
>> file?
> 
> Unless you have "invalid users = root" there shouldn't be a problem.
I saw that option but _want_ to be able to be root on my Samba shares.
It's a single operator machine.

> Try creating a file instead:
> 
>  $ touch /mnt/tillie/tmp/test.txt
> 
> And then see who owns the file - it should be root (if you're connected
> as root) but I suspect it'll be some other user.  You probably need to
> specify the user when you connect, i.e.
> 
>  $ smbmount smbmount tillie/all /mnt/tillie -o uid=0,username=root
> 
> Cheers,
> Adam.
> 


Thanks very much for your excellent suggestion Adam.

I found out the new file created by your touch command was owned by 
lba:users.  That was expected since I was in a shell as user lba.

However, when I tried to copy over a root owned file, first as su and 
then as su -, the operation failed.  Why can't I copy over a root owned 
file when I'm root?

I also noticed that, when I touched as su or su -, I could create the 
file but in each case owner was lba:users.  However, when I did the same 
touch within my own file system, the file owner became root.

I smbmounted the share with a simple _root_ script containing:
smbmount  //tillie/all  /mnt/tillie  -o uid=0
Shouldn't that have given me root priviledges?

Which leads to the question,  how do I act as root on a samba share?
Or perhaps the question is how do I become root on the share?
Is sharing as root okay or is it bad practice?  Why?

I appreciate your helping me very much.  You can see I'm a little 
confused how to take over my little network and bend it to my will <g>.

Larry

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


More information about the samba mailing list