From 188e4d10797a586a18de975b8f5c85e7952a0744 Mon Sep 17 00:00:00 2001 From: Andrea Dell'Amico Date: Thu, 20 Oct 2016 20:10:56 +0200 Subject: [PATCH] d4science-ghn-cluster: library/roles/smartgears/r_connector: fix the r_connector script that manages the users. Added the required commands to the sudoers file. --- smartgears/r_connector/templates/rusersadd.j2 | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/smartgears/r_connector/templates/rusersadd.j2 b/smartgears/r_connector/templates/rusersadd.j2 index 73dd6838..e4c001f2 100755 --- a/smartgears/r_connector/templates/rusersadd.j2 +++ b/smartgears/r_connector/templates/rusersadd.j2 @@ -3,28 +3,30 @@ USER="$1" HDIR="{{ r_connector_usershome }}$USER" logfile={{ smartgears_user_home }}/tomcat/logs/runuseradd.log -exec > $logfile 2>&1 +exec >> $logfile 2>&1 if [ -d $HDIR ] ; then - #echo "user dir exist" + echo "user $HDIR dir exists" exit 0 else if id -u $USER >/dev/null 2>&1 then - #"echo "ldap user first login" - sudo /bin/su - $USER /bin/ls + echo "ldap user $USER first login" + sudo /bin/mkdir -p $HDIR + sudo /bin/chown -R $USER $HDIR sudo /bin/chmod g+ws $HDIR sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }} sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }} sudo /bin/chgrp -R {{ smartgears_user }} $HDIR exit 0 else - #echo "user does not exist and is not ldap" + echo "user $USER does not exist and is not into ldap" sudo /usr/sbin/useradd -m -s /bin/false -g {{ smartgears_user }} $USER sudo /bin/chmod g+ws $HDIR sudo /usr/bin/touch $HDIR/{{ r_connector_userconfig }} sudo /bin/chmod 660 $HDIR/{{ r_connector_userconfig }} sudo /bin/chgrp -R {{ smartgears_user }} $HDIR + exit 0 fi fi