Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var express = require('express');
var http = require('http');
var app = express();
/*define routes here*/
var server = http.createServer(app);
server.listen(80, function(err){
if (err) {
console.log('error occurred trying to listen on port 80');
return;
}
var uid = parseInt(process.env.SUDO_UID); //get the UID of user who started application as sudo
if (uid) {
process.setuid(uid); //set uid of the process to user with lower privileges
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.