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
?
sudo
or is it enough to test if the current user isroot
(when running withsudo
, you areroot
). How would you usesudo
? And is this only for Debian? If so, why do you mention derivatives? Does that include things like Mint or Ubuntu?