Proc FS Read Only?

Colin Watson cjwatson at canonical.com
Tue Oct 26 10:38:32 UTC 2004


On Sat, Oct 16, 2004 at 05:40:15AM -0700, Can Sar wrote:
> I'm not currently on the Ubuntu list, so please CC me directly. I wrote 
> a ProcFS module, that I need to write to (the file it creates), but it 
> says I don't have permissions (this is with sudo).

You probably did:

  sudo echo foo > /proc/blah

However, when you do this, the "sudo-ness" only applies to the 'echo
foo', not to the '> /proc/blah', because of the way the shell works. In
order to get root privileges to apply to the redirection, you need to do
either this:

  sudo sh -c 'echo foo > /proc/blah'

... or this:

  sudo -s
  echo foo > /proc/blah
  exit

Cheers,

-- 
Colin Watson                                    [cjwatson at canonical.com]




More information about the ubuntu-users mailing list