If you're using perl here's a neat subroutine I was given to use:
and again you would refer to them as $pass and $userid
where the file would look like:
$userid=Admin
$password=dontsay
... joe.f.
-----------------------------------------------------------------
###########################
sub read_prop_file()
###########################
{
#
# read the property or environment file and set the variables in the
# file
#
# input: fully qualified file name
#
# return: None. Sets key:value pairs contained in file.
local($ENVFILE) = @_;
local($env_var,$env_value) = "";
if ("$ENVFILE" && open (ENVFILE, "< $ENVFILE"))
{
while (<ENVFILE>)
{
next if /^#/;
next if /^$/;
if (/([a-zA-Z0-9_]+)\s*=\s*(.*)$/)
{
$env_var = "$1";
$env_value = "$2";
$env_value =~ s/^"(.*)"$/\1/;
eval "\$$env_var=\"$env_value\"";
}
}
}
else
{
print "Problem with file $ENVFILE. Aborting...\n";
exit(1);
}
close(ENVFILE);
return(1);
} # end of subroutine: read_prop_file()
Joseph A Faracchio, Systems Programmer, UC Berkeley
On Wed, 4 Oct 2000, Ford, Phillip wrote:
> In our scripts os scripts we use the following:
>
> cat /etc/adsm/adsm | read usr pw
>
> then
>
> dsmadmc -id=$usr -password=$pw q ses
>
> the file /etc/adsm/adsm is protected from access for general users. Root
> and one group that would know the password anyway are the only ones that can
> read it.
>
> That is how we do it.
>
>
> --
> Phillip Ford
> Senior Software Specialist
> Corporate Computer Center
> Schering-Plough Corp.
> (901) 320-4462
> (901) 320-4856 FAX
> [EMAIL PROTECTED]
>
>
>
> -----Original Message-----
> From: Lisa Faulconer [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 04, 2000 9:31 AM
> To: [EMAIL PROTECTED]
> Subject: ADMIN Password Issues
>
>
> We currently have our ADMIN id and password in several scripts. Our
> scripts perform a number of functions from redirecting output from the act
> log to a file (AIX) to issuing the DRM commands. The scripts are scheduled
> with the *SM scheduler.
>
> Macros would eliminate the need to have the id and password in a file but
> macros can not be scheduled with the *SM scheduler.
>
> Has anyone addressed this issue? Appreciate any suggestions.
>
> Lisa
>