Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/bin/sugar.in
diff options
context:
space:
mode:
authorSascha Silbe <sascha@silbe.org>2010-01-22 13:18:16 (GMT)
committer Sascha Silbe <sascha@silbe.org>2010-01-22 13:18:16 (GMT)
commit51140065a24329869353f970e37bb4f85110482d (patch)
treed082abb6b3344e5cf8e36718c46daab68e5e0edc /bin/sugar.in
parentbe156e18869ef888ade1a6d2268e49ff97742ddf (diff)
sugar, sugar-emulator: refuse to run as root (#1675)
It's a very bad idea to run Sugar as root for a variety of reasons, but there seem to be people who try it (and fail) nevertheless. Failing early and with a clear message increases safety and safes precious developer and user time.
Diffstat (limited to 'bin/sugar.in')
-rw-r--r--bin/sugar.in5
1 files changed, 5 insertions, 0 deletions
diff --git a/bin/sugar.in b/bin/sugar.in
index 12768a5..498b573 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -1,5 +1,10 @@
#!/bin/sh
+if [ "$(id -u)" -eq 0 -o "$(id -ru)" -eq 0 ] ; then
+ echo Refusing to run as root.
+ exit 3
+fi
+
usage() {
cat <<EOF
Usage: sugar [OPTION]..