diff --git a/datastore_server/dist/datastore_server.sh b/datastore_server/dist/datastore_server.sh index 93f06c6e4bcf0eea47485ea9ee0e1530d76f2222..80ad1777fb5e9764ab0d68cb4e2cc3053dfbddf4 100755 --- a/datastore_server/dist/datastore_server.sh +++ b/datastore_server/dist/datastore_server.sh @@ -42,6 +42,14 @@ isPIDRunning() fi } +checkNotRoot() +{ + if [ $UID -eq 0 ]; then + echo "openBIS Data Store Server cannot run as user 'root'." > /dev/stderr + exit 1 + fi +} + rotateLogFiles() { logfile=$1 @@ -143,6 +151,7 @@ CMD="${JAVA_BIN} ${JAVA_OPTS} -classpath $CP ch.systemsx.cisd.openbis.dss.generi command="${command#--*}" case "$command" in start) + checkNotRoot getStatus EXIT_STATUS=$? if [ $EXIT_STATUS -eq 0 ]; then diff --git a/openbis/dist/server/startup.sh b/openbis/dist/server/startup.sh index aab609826e8218d29de517f67a06ce6c7e085a48..87e75b481f0a146081089a30e0c0e02981bfc0fb 100755 --- a/openbis/dist/server/startup.sh +++ b/openbis/dist/server/startup.sh @@ -1,5 +1,10 @@ #! /bin/bash +if [ $UID -eq 0 ]; then + echo "openBIS Application Server cannot run as user 'root'." > /dev/stderr + exit 1 +fi + source `dirname "$0"`/setup-env $JVM -DSTOP.PORT=$JETTY_STOP_PORT \ -DSTOP.KEY=$JETTY_STOP_KEY \