On Sat, Apr 29, 2023 at 01:52:11AM +0200, cor...@free.fr wrote:
> $ sudo echo 123 > /root/123.txt
> 
> It tells me "permission rejected".
> 
> Why this sudo can't get success?

Because the redirection is done by your shell before sudo is executed.

See <https://mywiki.wooledge.org/BashPitfalls#pf53> for suggestions,
but basically you're looking at variants of:

    sudo sh -c 'echo 123 > /root/123.txt'

Reply via email to