Webmin echo built-in versus /usr/bin/echo -Ubuntu-

Ubuntu 22.04.1 LTS Codename: jammy
Webmin version 2.010

I’ve got tons of custom commands. In RHEL they used to work fine but some of the custom commands have “echo -e” in menu’s that are built. I noticed the “-e” is showing up in the menus because echo isn’t recognizing the “-e” and this is due to webmin utilizing the built-in echo within the shell versus /usr/bin/echo. If I modify the custom command and replace /usr/bin/echo for the “echo” then the “-e” get’s used as intended and doesn’t show up on the custom command menu. Is there any way to ask webmin to prefer the /usr/bin/echo versus the built in? I understand there are security reasons for echo being built-in but so far I don’t have a reason to NOT switch the behavior of webmin if possible. TIA.

Can I pass some kind of custom environment variable to webmin that says echo=“/usr/bin/echo” via the Operating System and Environment controls within webmin and if yes. What would the variable name and value be? echo = variable name and /usr/bin/echo = value?

How can I do this to force webmin the same way?
I can set an alias to echo in /etc/profile alias echo=“/usr/bin/echo”

root@ip-10-0-0-244:~# type -a echo
echo is aliased to `/usr/bin/echo’
echo is a shell builtin
echo is /usr/bin/echo
echo is /bin/echo

Under webmin: > type -a echo
-a: not found
echo is a shell builtin

type echo
echo is a shell builtin

Where do I change this behavior so that it behaves as the /bin/bash shell does?

I’m not sure. I’ll ask @Jamie to check in on this thread, he’d know how to munge Webmin’s execution environment for Custom Commands.

Thanks. I’m additionally exploring workarounds.

Webmin just runs custom commands using the root user’s shell, so if echo is run as a built-in by default the same will happen in the custom command. The only work-around is to use the full /usr/bin/echo path.

1 Like

Jamie, I just checked on this and it would seem this (where ubuntu is concerned) is a little different than described based on the following tests:
root@ip-10-0-0-244:~# echo $0
If I use the Command Shell module in Webmin I see the following:

echo $0

So webmin custom commands won’t support any “interactive” features because it’s running in non interactive mode?

Custom commands don’t support interactive operations in any case, regardless of the shell being used.

1 Like