Detect if have got sudo right info
node.js
Solution
I can't ensure this is correct since I currently have no way of testing it but if I remember correctly you should be able to use the `getuid()` function from the `process` package (Documentation). (Note: This only works on POSIX platforms, which means no Windows)
This should return `"root"` when you run the command with super user permissions.
IMPORTANT You should never run a webserver like node with super user permissions. If you need the permissions for some setup work you should revert the granted root permissions by doing something like this at the end of your initialization work:
var uid = parseInt(process.env.SUDO_UID);
if (uid) process.setuid(uid);
Problem
Is it possible to detect that I have the right sudo when I run ``` node app.js ``` I hope that when I run the command ``` sudo node app.js ``` it will tell me that the app.js node is running with the right sudo.