You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by nc...@apache.org on 2016/09/12 16:59:36 UTC

[10/10] ambari git commit: AMBARI-17728: Error message does not deliver when executing ambari-server command as a non-root use (wang yaoxin via jluniya)

AMBARI-17728: Error message does not deliver when executing ambari-server command as a non-root use (wang yaoxin via jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e4cb41e0
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e4cb41e0
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e4cb41e0

Branch: refs/heads/branch-dev-patch-upgrade
Commit: e4cb41e0ab469788180f3ac5741d331706b46ea0
Parents: 623c36d
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Mon Sep 12 09:50:49 2016 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Mon Sep 12 09:50:49 2016 -0700

----------------------------------------------------------------------
 ambari-server/sbin/ambari-server | 7 +++++++
 1 file changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e4cb41e0/ambari-server/sbin/ambari-server
----------------------------------------------------------------------
diff --git a/ambari-server/sbin/ambari-server b/ambari-server/sbin/ambari-server
index e055650..f52a598 100755
--- a/ambari-server/sbin/ambari-server
+++ b/ambari-server/sbin/ambari-server
@@ -55,6 +55,13 @@ AMBARI_ENV="$ROOT/var/lib/ambari-server/ambari-env.sh"
 AMBARI_PYTHON_EXECUTABLE="$ROOT/usr/sbin/ambari-server.py"
 AMBARI_EXECUTABLE="$ROOT/usr/sbin/ambari-server"
 
+current_user=`id -u -n`
+echo "" | sudo -S -l > /dev/null 2>&1
+if [ "$?" != "0" ] && [ "$EUID" -ne 0 ] ; then
+ echo "You can't perform this operation as non-sudoer user. Please re-login or configure sudo access for this user."
+ exit -1
+fi
+
 if [ -z "$PYTHON" ] ; then
   export PYTHON=`readlink $PYTHON_WRAP`
 fi