To use a command with the "echo into a file" redirection operator >> through sudo... command, I
have written that to redirect through standard input to the sudo process, executed as the superuser.
The command to redirect was echo "tun" >> /etc/modules-load.d/tun.conf, here I put whoami in its place.
I tried
echo 'whoami' | sudo -i '$SHELL -c "exec $(< /dev/stdin)"'
and next,
echo 'whoami' | sudo -i '$SHELL -c "$(< /dev/stdin)"'
and sh responded -sh: /bin/sh -c "$(< /dev/stdin)": not found.
What is that for? Why does the Alpine Linux distribution shell not find my commands executed through sudo?
sudo -V (version number and compiled versions):
Sudo version 1.9.15p5
Sudoers policy plugin version 1.9.15p5
Sudoers file grammar version 50
Sudoers I/O plugin version 1.9.15p5
Sudoers audit plugin version 1.9.15p5
Thank you for anything answered! 🙂
echo 'whoami' | sudo -i $SHELL -c "exec $(< /dev/stdin)"exec $(< /dev/stdin)in two', sorry.