From d9abe9224e6a6101b2797c9ab59c3c7dec3daf65 Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Tue, 19 Jun 2018 16:17:42 +0300 Subject: [PATCH] Warn if config owner doesn't match process uid --- src/command-line/index.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/command-line/index.js b/src/command-line/index.js index 3665b00c..a6206332 100644 --- a/src/command-line/index.js +++ b/src/command-line/index.js @@ -34,6 +34,16 @@ if (!fs.existsSync(path.join( Helper.setHome(process.env.THELOUNGE_HOME || Utils.defaultHome()); +// Check config file owner and warn if we're running under a different user +if (process.getuid) { + fs.stat(path.join(Helper.getHomePath(), "config.js"), (err, stat) => { + if (!err && stat.uid !== process.getuid()) { + log.warn("Config file owner does not match the user you are currently running The Lounge as."); + log.warn("To avoid issues, you should execute The Lounge commands under the same user."); + } + }); +} + Utils.checkOldHome(); // Merge config key-values passed as CLI options into the main config