We are creating this nodejs script for Debian version 9 or 10, to be specific, but it needs to run as sudo or a user that has same privileges as root. Below is sample code:
exec('iptables -S',
function (err, stdout, stderr) {
resolve(stdout)
if (err !== null) {
reject(err.toString('utf8'));
}
})
So our question is do all debian based linux distributions use sudo? If yes, case closed.
But if the answer is no, what are other alternatives so this command can be used and run by other user group or any other user that will always be present in a Debian distribution and doesn't use sudo?