Hugo Mills wrote:
> On Sun, Sep 20, 2009 at 11:14:19AM +0100, Rob Malpass wrote:
>   
>> Hi all
>>
>> I'm having a problem writing to one of my NAS devices with my Ubuntu
>> box.  Here's the setup:
>>
>> 2 PCs (one XP (marsh) and one Ubuntu (thomson))
>> 2 NAS's (cnfs and cnfsusb).
>>
>> marsh (the XP box) can read and write to both NAS's.
>> thomson can write to cnfs, but not to cnfsusb
>>
>> So one would think that it must be something to do with the
>> permissions on cnfsusb - but the user I login as on XP is the same
>> user I login as when I mount cnfsusb on thomson.  I've set the
>> permissions on the mount point such that any user can write to it -
>> but when I mount it - these permissions are mysteriously reset back
>> such that only root can write to it.  Trouble is - even trying a
>> simple
>>
>> sudo uname > /mnt/cnfsusb/fred 
>>     
>
>    Note that this probably doesn't do what you think it does. The
> redirect is applied by the shell that you're running in, so it's
> writing the output of the sudo command (which is itself the output of
> the uname command) as the user that executed the sudo command. What
> you probably want is this:
>
> sudo bash -c "uname >/mnt/cnfusb/fred"
>
> In this case, the redirection is being done by the shell run from
> inside sudo, and therefore is set up to write as the superuser.
>
>   
>> results in a permission denied.  The mount command I'm using is
>> exactly the same to mount cnfs as cnfsusb.
>>     
>
>    Hugo.
>
>   
Aha - thank you very much Hugo - you're dead right.   I can now write to 
the "share" using your sudo bash example.
However, interestingly that's the only way I can write, or even read or 
remove files.   Should I be looking at umask here?
Cheers
Rob