I'd like to send a command from a protocol to retrieve data from a Linux server via SSH.
However that command needs sudo elevated privileges. The response I retrieve is just the text that is asking for a username/pwd.
How can I do this from a protocol, please?
Can you change files on the box itself? otherwise an option can be setup passwordless sudo for that user: https://linuxhint.com/setup-sudo-no-password-linux/
or just some commands: https://askubuntu.com/questions/159007/how-do-i-run-specific-sudo-commands-without-a-password
I prefer not to do that, because in order to use that protocol, no user settings have to be adjusted on the machine itself…
Security wise it’s probably safest to only grant the specific commands sudo without password permission. Or if only the dmidecode command needs sudo privileges, you could consider fetching the same information from /sys/devices/virtual/dmi/id, /proc/cpuinfo or /proc/meminfo