Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'No, incorrect' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
No, incorrect
Authored by: rorya on Nov 05, '07 08:43:15AM

Redirection occurring outside the context of sudo(8), will be done as the user who called sudo(8), rather than the user with the privileges of the user provided with sudo(8), such as the superuser in this case.

Therefore, since /etc is a directory owned by the superuser, you must include the redirect within sudo(8)'s context, for the write to succeed. So..:

sudo sh -c 'echo "I love vi and Unix!" > /etc/motd'

"Any sufficiently advanced technology is indistinguishable from magic" - Arthur C. Clarke

[ Reply to This | # ]
Re: No, incorrect
Authored by: MJCube on Dec 25, '07 07:01:48PM

Thanks for that explanation, rorya.

[ Reply to This | # ]