From ca687a949b3c01472c10e53b8b3576ee591fd7eb Mon Sep 17 00:00:00 2001 From: lissav Date: Tue, 28 Apr 2009 15:12:53 +0000 Subject: [PATCH] add ability to write the creds to a directory, not user's home. We need this when the /u is mounted on the MN and root does not have write access to any user directories git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3269 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- .../share/xcat/scripts/setup-local-client.sh | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/xCAT-server/share/xcat/scripts/setup-local-client.sh b/xCAT-server/share/xcat/scripts/setup-local-client.sh index 31c54862a..617ba6fea 100755 --- a/xCAT-server/share/xcat/scripts/setup-local-client.sh +++ b/xCAT-server/share/xcat/scripts/setup-local-client.sh @@ -1,5 +1,14 @@ - # IBM(c) 2007 EPL license http://www.eclipse.org/legal/epl-v10.html +# set up credentials for user to be able to run xCAT commands +# Must be run by root +# Interface +# setup-local-client.sh - setup root credentials +# setup-local-client.sh user1 - set up user1 credentials and store in +# $HOME/.xcat +# setup-local-client.sh user2 /tmp/user2 - setup user2 credentials and +# store in /tmp/user2/.xcat. Must later be copied to +# $HOME/xcat for user2. Used when root cannot write to +# the home directory of user2 (e.g when mounted). umask 0077 #nothing make by this script should be readable by group or others @@ -9,15 +18,19 @@ fi if [ -z "$1" ]; then set `whoami` fi -CNA="$*" - +# if diretory is not supplied then just use home +if [ -z "$2" ]; then + CNA="$*" # getent doesn't exist on AIX -if [ -x /usr/bin/getent ];then - USERHOME=`getent passwd $1|awk -F: '{print $6}'` + if [ -x /usr/bin/getent ];then + USERHOME=`getent passwd $1|awk -F: '{print $6}'` + else + USERHOME=`grep ^$1: /etc/passwd | cut -d: -f6` + fi else - USERHOME=`grep ^$1: /etc/passwd | cut -d: -f6` + CNA="$1" + USERHOME=$2 fi - XCATCADIR=$XCATDIR/ca if [ -e $USERHOME/.xcat ]; then