diff --git a/tsshbatch.py b/tsshbatch.py index 3d9d869..f870bbc 100755 --- a/tsshbatch.py +++ b/tsshbatch.py @@ -12,7 +12,7 @@ PROGNAME = "tsshbatch.py" BASENAME = PROGNAME.split(".py")[0] PROGENV = BASENAME.upper() -RCSID = "$Id: tsshbatch.py,v 1.121 2011/12/28 18:37:03 tundra Exp $" +RCSID = "$Id: tsshbatch.py,v 1.122 2011/12/30 20:39:48 tundra Exp $" VERSION = RCSID.split()[2] CPRT = "(c)" @@ -83,13 +83,14 @@ eFEWARGS = "Too few command line arguments!" eNOCONNECT = "Cannot Connect! (Name/Address Bad? Destination Unreachable?)" eNOLOGIN = "Cannot Login! (Login/Password Bad?)" -eSUDOPW = "Must Specify Password When Using %s Commands!" % SUDO + ##### # Prompts ##### pPASS = "Password: " +pSUDO = "%s Password: " % SUDO pUSER = "Username: " @@ -294,12 +295,14 @@ else: CMD = " ".join(args[0:]) -# If user want 'sudo' execution, they MUST provide a password -# because key exchange-based authentication is not part of sudo +# If user want 'sudo' execution, they MUST provide a password because +# key exchange-based authentication is not part of sudo. If the +# password has not been set by some other means (command line or +# environment variable), ask for it here. CMD = CMD.strip() if CMD.startswith(SUDO) and not PWORD: - ErrorExit(eSUDOPW) + PWORD = getpass.getpass(pSUDO) # Iterate over the list of hosts, executing the command