How do you redirect the output of gksudo as the root user? For instance, "gksudo cmd > file1" outputs file1 under the original user, not root. Trying:
Code:
gksudo 'cmd > file1'
does not work at all. There are tricks with sudo that work, such as:
Code:
sudo bash -c 'cmd > file'
but:
Code:
gksudo bash -c 'cmd > file'
does not work. I also noticed that gksudo does not seem to output stderr; if you run "gksudo cmd" in the terminal window (and assuming cmd normally outputs to the terminal), then cmd will output stdout to the terminal but not stderr. This is unlike sudo which handles both stdout and stderr.
Unfortunately I can't just simply use sudo, because I'm using it in a bash script that will be run from a desktop shortcut--there is no terminal involved, so I need the graphical input of gksudo for accepting the password.
Any ideas of how to make gksudo work in this case? Any insight/help would be greatly appreciated.