Re: Write to file forbidden



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


--
ubuntu-users mailing list
ubuntu-users@xxxxxxxxxxxxxxxx
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users



Relevant Pages

  • Re: Invisible Boot Drive?
    ... That icon is odd, but it might be a red herring. ... The most likely explanation is that the root directory of your hard ... If the hidden flag is set, ... sudo chflags nohidden / ...
    (comp.sys.mac.system)
  • Re: Write to file forbidden
    ... from the root directory. ... That would be nearly all files - hidden files would stay hidden. ... There is no big difference between sudo and gksudo in this case because, ... it operates on the ls command not on the output redirection. ...
    (Ubuntu)
  • Re: Users and Groups ID
    ... On Jun 22, 2008, at 11:12 AM, Smoot Carl-Mitchell wrote: ... to get a root shell and then do the above. ... Just a hint: ... There's no need to have sudo call the program 'su' to get a login ...
    (Ubuntu)
  • Re: Users and Groups ID
    ... to get a root shell and then do the above. ... Just a hint: ... There's no need to have sudo call the program 'su' to get a login ... Smoot Carl-Mitchell ...
    (Ubuntu)