diff --git a/tsshbatch.py b/tsshbatch.py index e4adb4b..99199c2 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -20,7 +20,7 @@ CMDINCL = PROGENV + "CMDS" HOSTINCL = PROGENV + "HOSTS" -CVSID = "$Id: tsshbatch.py,v 1.214 2016/01/10 17:15:54 tundra Exp $" +CVSID = "$Id: tsshbatch.py,v 1.215 2016/01/10 18:48:23 tundra Exp $" VERSION = CVSID.split()[2] CPRT = "(c)" PROGDATE = "2011-2016" @@ -870,27 +870,29 @@ # 3) Command Line/$TSSHBATCH env variable sets name # 4) Name picked up from $USER (Default behavior) -if not KEYEXCHANGE: - # Preset commandline and/or program option variable username takes precedence +# Regardless of authorization type, we need a user name. +# Preset commandline and/or program option variable username takes +# precedence - if not UNAME: - UNAME = os.getenv(USERVAR) +if not UNAME: + UNAME = os.getenv(USERVAR) - # By default, use the above as the login name and don't prompt for it - # unless overriden on the command line with -N +# By default, use the above as the login name and don't prompt for it +# unless overriden on the command line with -N - if PROMPTUSERNAME: +if PROMPTUSERNAME: - current_user = UNAME - UNAME = raw_input(pUSER %current_user) - if not UNAME: # User just hit return - wants default - UNAME = current_user + current_user = UNAME + UNAME = raw_input(pUSER %current_user) + if not UNAME: # User just hit return - wants default + UNAME = current_user - # Preset commandline and/or program option variable password takes precedence +# For password auth, preset commandline and/or program option +# variable password takes precedence - if not PWORD: - PWORD = getpass.getpass(pPASS) +if not KEYEXCHANGE and not PWORD: + PWORD = getpass.getpass(pPASS) ##### # If Needed, Get sudo Password