set up a root password
John L Fjellstad
john-ubuntu at fjellstad.org
Tue Aug 12 19:35:33 UTC 2008
Derek Broughton <news at pointerstop.ca> writes:
> Joel Oliver wrote:
>
>> OK, redirection is borked using sudo.
>
> How so? Of course, you can't do "sudo command >/root/file", but you
> can't do that with "su", either. I can't say I've tried to work
> around it, I just use "sudo -i", but I'm sure it can be done with
> appropriate quoting.
Sure you can
$ sudo "echo hello > tmp.txt"
[sudo] password for [user]:
sudo: echo hello > tmp.txt: command not found
$ su -c "echo hello > tmp.txt"
Password:
$
In fact, I usually do this to work around the fact that sudo can't
redrect
sudo su -c "command > somefile"
You can work around it by using the tee command:
echo "hello" | sudo tee tmp.txt
--
John L. Fjellstad
web: http://www.fjellstad.org/ Quis custodiet ipsos custodes
More information about the kubuntu-users
mailing list