You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2015/06/16 15:58:02 UTC

[2/2] ambari git commit: AMBARI-11948. If couple of users have the same UID as root (or amari user) ambari-agent fails to start (aonishuk)

AMBARI-11948. If couple of users have the same UID as root (or amari user) ambari-agent fails to start (aonishuk)


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

Branch: refs/heads/branch-2.1
Commit: 66eecc810d34ffae6f4f60295a621589f67ae2a6
Parents: 8cf944b
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Tue Jun 16 16:57:55 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Tue Jun 16 16:57:55 2015 +0300

----------------------------------------------------------------------
 ambari-agent/conf/unix/ambari-agent | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/66eecc81/ambari-agent/conf/unix/ambari-agent
----------------------------------------------------------------------
diff --git a/ambari-agent/conf/unix/ambari-agent b/ambari-agent/conf/unix/ambari-agent
index bc61af2..2d38067 100755
--- a/ambari-agent/conf/unix/ambari-agent
+++ b/ambari-agent/conf/unix/ambari-agent
@@ -48,10 +48,10 @@ AMBARI_AGENT_PY_SCRIPT=/usr/lib/python2.6/site-packages/ambari_agent/AmbariAgent
 OK=1
 NOTOK=0
 
-current_user=`awk -v val=$EUID -F ":" '$3==val{print $1}' /etc/passwd`
+current_user=`id -u -n`
 echo "" | sudo -S -l > /dev/null 2>&1
-if [ "$?" != "0" ] && [ "$current_user" != "root" ] ; then
- echo "You can't perform this operation as non-sudoer user. Please, re-login as one"
+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 0
 fi