current-processes icon indicating copy to clipboard operation
current-processes copied to clipboard

Throw error when not run as root

Open branneman opened this issue 10 years ago • 5 comments

branneman avatar Jun 20 '14 09:06 branneman

Is this even possible?

branneman avatar Jun 20 '14 23:06 branneman

i guess with these it might be possible:

console.log process.getuid() # user id (0 for root)
console.log process.getgid() # group id (0 for root)
screen shot 2015-09-02 at 09 24 44

linus-amg avatar Sep 02 '15 14:09 linus-amg

Why does this module require root? Only thing it seems to be doing is running ps -A -o pid,rss,vsz,pcpu,comm and parsing it? I noticed that command works on both OS X and XUbuntu. Also the example script works, when non root and no sudo.

Does only some distros require root for this? Not sure if throwing a error is a good idea if it works on the platform. Really curious on why, as I haven't ran into any issues being non root yet. Plus I know generally it's not recommended to run things as root on servers.

keverw avatar May 22 '16 19:05 keverw

@keverw It's definitely needed for Windows users, I'm not entirely sure for unix/linux/osx.

branneman avatar May 23 '16 09:05 branneman

@branneman Interesting. I noticed some other modules use ps and didn't mention the need of root. So maybe just a Windows thing then.

I just hope if you implement throwing a error that it would check if it would run and then only throw if permissions related. So just try the PS command or Windows API first then have a error if it can't function without permissions.

Otherwise this is a great module :)

keverw avatar May 23 '16 14:05 keverw