Write to file forbidden

GaryT taig at melbpc.org.au
Mon Mar 16 14:47:43 UTC 2009


Smoot Carl-Mitchell wrote:
> On Mon, 2009-03-16 at 00:47 +1100, GaryT wrote:
>   
>> To obtain a recursive listing of all files, I'll use the command
>> 	ls -s -S -R
>> from the root directory.
>>
>> BUT
>> When attempting to capture that list by saving it to a text file, I get
>> "permission denied"
>> 	e.g.	ls -s -S -R >files.txt
>>
>> adding sudo makes no difference
>> using gksudo also makes no difference.
>>
>> please, how does one overcome the problem?
>>     
> The redirect is opening the output file in the / directory before the
> sudo command is executed.  Redirects are handled by the parent shell and
> not by sudo. Try it from your home directory. e.g.
> sudo ls -sSR / >files.txt
Many thanks, Smoot.
GT





More information about the ubuntu-users mailing list