index a1f1208..47770b6 100644 --- a/server/helpers/launcher.js +++ b/server/helpers/launcher.js @@ -1,5 +1,5 @@ var kiwi_app = '../kiwi.js'; -var pidfile = '../../kiwiirc.pid'; +var pidfile = '/run/kiwiirc/kiwiirc.pid'; var pidfile_arg; // Check if a pidfile has been set as an argument @@ -16,6 +16,13 @@ if (process.argv.indexOf('-p') > -1) { } } +try { + process.setgid('kiwiirc'); + process.setuid('kiwiirc'); +} catch (e) { + console.error('Cannot switch to user kiwiirc. Try running as root.') + process.exit(); +} var daemon = require('daemonize2').setup({ main: kiwi_app,